View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 380
Default Range (variable)

No need to select

Range("B" & EndDate).copy Worksheets("Sheet2").Range("B" & EndDate)

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"bobbo" wrote in message
oups.com...
Reading your post more closely I think that Endate is a variable in
your procedure.
You just need to replace one of your quotes. This assumes that enddate
returns an integer value that is the row you wish to use.

Range("b" & Enddate).Select

Also you do not have to select a range to manipulate it. This is
probably something that will make your scripting faster.


bobbo wrote:
if enddate is a named range then this should work
Range("b" & Names("Enddate").RefersToRange.Row)
Names("Enddate").RefersToRange.row will return the first row of the
named range Enddate.


LyleF wrote:
I need to copy a range from one sheet into the exact same row in

several
other sheets. I also need to make the row a variable so it can be

changed
each month and then run the macro with the new row number.
Enddate is the variable and is being picked up correctly. I am

getting
error 1004
as I try to pass Enddate into the range. Below is where I am now.

Range("b&Enddate").Select
--
Thanks
Lyle