Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to use variables to reference row ranges but don't know the syntax
or correct command. Instead of using a command like: Range("5:9") I'm trying to reference a number of row groups i.e. 5:9, 10:14, 15:19 and would like to be able to use a command like: Range("var1,var2") but this doesn't seem to work. Any ideas.... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
one way: Dim var1 As String Dim var2 As String var1 = "5:9" var2 = "10:14" Debug.Print Union(Range(var1), Range(var2)).Address another: Debug.Print Range(var1 & "," & var2).Address In article , VicWestVan wrote: I'm trying to use variables to reference row ranges but don't know the syntax or correct command. Instead of using a command like: Range("5:9") I'm trying to reference a number of row groups i.e. 5:9, 10:14, 15:19 and would like to be able to use a command like: Range("var1,var2") but this doesn't seem to work. Any ideas.... |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
do you want to act on the entire row?
one way Range(Rows(3), Rows(5)).Select -- Gary "VicWestVan" wrote in message ... I'm trying to use variables to reference row ranges but don't know the syntax or correct command. Instead of using a command like: Range("5:9") I'm trying to reference a number of row groups i.e. 5:9, 10:14, 15:19 and would like to be able to use a command like: Range("var1,var2") but this doesn't seem to work. Any ideas.... |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use syntax like this:
Range("4:10,16:21,26:30").Select Hope this helps, Hutch "VicWestVan" wrote: I'm trying to use variables to reference row ranges but don't know the syntax or correct command. Instead of using a command like: Range("5:9") I'm trying to reference a number of row groups i.e. 5:9, 10:14, 15:19 and would like to be able to use a command like: Range("var1,var2") but this doesn't seem to work. Any ideas.... |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom...
Thx for your comment. Actually not trying to reference the rows at the same time but conditional on other factors i.e. If EventA then Var1 = 10 var 2 = 14 else Var 1 = 20 var 2 = 24 End if Range("var1, var2") Any thoughts? "Tom Hutchins" wrote: Use syntax like this: Range("4:10,16:21,26:30").Select Hope this helps, Hutch "VicWestVan" wrote: I'm trying to use variables to reference row ranges but don't know the syntax or correct command. Instead of using a command like: Range("5:9") I'm trying to reference a number of row groups i.e. 5:9, 10:14, 15:19 and would like to be able to use a command like: Range("var1,var2") but this doesn't seem to work. Any ideas.... |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Range(var1 & ":" & var2) In article , VicWestVan wrote: Tom... Thx for your comment. Actually not trying to reference the rows at the same time but conditional on other factors i.e. If EventA then Var1 = 10 var 2 = 14 else Var 1 = 20 var 2 = 24 End if Range("var1, var2") Any thoughts? "Tom Hutchins" wrote: Use syntax like this: Range("4:10,16:21,26:30").Select Hope this helps, Hutch "VicWestVan" wrote: I'm trying to use variables to reference row ranges but don't know the syntax or correct command. Instead of using a command like: Range("5:9") I'm trying to reference a number of row groups i.e. 5:9, 10:14, 15:19 and would like to be able to use a command like: Range("var1,var2") but this doesn't seem to work. Any ideas.... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
variable ranges | Excel Discussion (Misc queries) | |||
Help with Variable Ranges! | Excel Discussion (Misc queries) | |||
Variable Ranges | Excel Worksheet Functions | |||
variable reference ranges | Excel Discussion (Misc queries) | |||
Counting variable ranges and auto-summing variable ranges | Excel Programming |