Hi Dustin,

You have to use the 'Cells' thingy instaed of the 'Range' thingie. Then you can 
use variables. But you have to use Column numbers, not Column letters, and you 
have to put the Row first, then the Column, separated by a comma.

 

Example:

YourRow=5   'Row

YourCol=3    'Column

 

Cells(YourRow, YourCol) is the same as Range("C5")

 

If you want a multi-cell range, the syntax is:

 

Range(Cells(YourRow, YourCol), Cells(MyRow, MyCol))

 

If MyRow=20 and MyCol=10, the above would be the same as:

Range("C5:J20")

 

You can also use just numbers if you want:

 

Cells(3, 2) is the same as Range("B3")

 

Hope this helps.

 

Regards - Dave.
 
> Date: Thu, 23 Apr 2009 10:54:34 -0700
> Subject: $$Excel-Macros$$ Macro Help
> From: dustin.ho...@gmail.com
> To: excel-macros@googlegroups.com
> 
> 
> Okay guys, I can't get this one. I've been trying for hours to make
> this work and I am missing something small.
> 
> Here's the deal: This is part of a larger set of macros I am writing.
> This snippet shows that I am looking for the next available row and
> then copying from a worksheet called RAW and then pasting that range
> into the next available row on the ExecServices worksheet.
> 
> 
> Worksheets("RAW").Range("A4701:CE4900").Copy _
> Destination:=Worksheets("ExecServices").Range("A" & iNextRow)
> 
> Note that "iNextRow" is a variable for the next available row.
> 
> the above code works great. What I need, is to NOT have static cell
> references like ***Range("A4701:CE4900")****. I want to be able to
> specify those ranges with variables. So what I want will (I think)
> look something like this:
> 
> Worksheets("RAW").Range("A4701:CE4900").Copy _
> Destination:=Worksheets("ExecServices").Range("A" & iNextRow:"CE" &
> iNextRow)
> 
> but this returns an error any way I try to do it.
> 
> I love this group and I have a lot of faith in you guys already =)
> Help is very much appreciated!!
> 
> also, as a side note... is there a way to be notified when your
> discussion post is replied to?
> 
> Dustin
> 
> 
> 
> > 

_________________________________________________________________
Looking for a fresh way to share photos? Get the new Windows Live Messenger.
http://download.live.com/
--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to