Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting a Range Using a Variable
Does anybody know what the marco command(s) are for
selecting a range of cells in a column using a variable? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting a Range Using a Variable
yes, hope this example helps:
Sub SelectRows2To5InCol() Dim Col Col = 3 Range(Cells(2, Col), Cells(5, Col)).Select End Sub regards, Mika "Bob J." wrote in message ... Does anybody know what the marco command(s) are for selecting a range of cells in a column using a variable? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting a Range Using a Variable
Bob,
If its the row, its easy Range("A" & startRow & ":B" & endRow).Select Columns are just as easy if your variable is a letter, but if it is a number, you either convert to a letter Range("A1:" & Chr(startcol + 64) & "10").Select or use Cells Range("A1", Cells(10, startcol)).Select -- HTH Bob Phillips "Bob J." wrote in message ... Does anybody know what the marco command(s) are for selecting a range of cells in a column using a variable? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting a Range Using a Variable
Thanks! This is exactly what I was looking for.
-----Original Message----- yes, hope this example helps: Sub SelectRows2To5InCol() Dim Col Col = 3 Range(Cells(2, Col), Cells(5, Col)).Select End Sub regards, Mika "Bob J." wrote in message ... Does anybody know what the marco command(s) are for selecting a range of cells in a column using a variable? . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting a Range Using a Variable
Thanks! This is exactly what I was looking for.
-----Original Message----- Range(Cells(TopLeftRow,TopLeftColumn),Cells (BottomRightRow,BottomRightColumn )).Select Note that you don't need to 'select' a range to use it.. With Range(Cells(TopLeftRow,TopLeftColumn),Cells (BottomRightRow,BottomRightColumn )) .Clear .Interior.Colorindex=3 End With -- Patrick Molloy Microsoft Excel MVP ---------------------------------- "Bob J." wrote in message ... Does anybody know what the marco command(s) are for selecting a range of cells in a column using a variable? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find a single value from tables by selecting two variable inputs? | Excel Worksheet Functions | |||
Selecting a variable print area in a macro | Excel Discussion (Misc queries) | |||
macro syntax for selecting variable range | Excel Discussion (Misc queries) | |||
Selecting Variable Data Ranges | Excel Discussion (Misc queries) | |||
Selecting rows with variable | Excel Programming |