Selecting a Range with a Variable in VB
Thanks.
I think I just had problems understanding how the parameters in the range
property functioned. The help documentation seemed to separate the
parameters with a colon, but then suggested that multiple sections be divided
by a comma. That was confusing.
The following table illustrates some A1-style references using the Range
property.
Reference Meaning
Range("A1") Cell A1
Range("A1:B5") Cells A1 through B5
Range("C5:D9,G9:H16") A multiple-area selection
Range("A:A") Column A
Range("1:1") Row 1
Range("A:C") Columns A through C
Range("1:5") Rows 1 through 5
Range("1:1,3:3,8:8") Rows 1, 3, and 8
Range("A:A,C:C,F:F") Columns A, C, and F
"Jim Thomlinson" wrote:
Not 100% sure what you are looking for but perhaps this is close...
range(Cells(1,1), cells(5,5)).select
--
HTH...
Jim Thomlinson
"ClinicITguy1" wrote:
Hello All,
I am trying to update a macro. I know that I can select an individual cell
using a variable by using the Cells property. I simply insert the variable
into the parameter as an index number for a row or column. However, if I
want to work with a range of cells, there is no way to pass a variable into
the Range property.
I'm sure this is a basic quesiton for you programmers out there. Can
someone please drop me a dime?
|