Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range (variable)
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range (variable)
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range (variable)
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range (variable)
Perfect, I never do get those quotes right the first time.
-- Thanks Lyle "bobbo" wrote: 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
variable range | New Users to Excel | |||
select range and put range address in variable | Excel Programming | |||
Macro to copy a specified range to a variable range | Excel Programming | |||
setting a range variable equal to the value of a string variable | Excel Programming | |||
Problem trying to us a range variable as an array variable | Excel Programming |