Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I know this code isn't correct, but it's what I've got so far.
Range((c + 2) & "2").Select "c" is a variable in which was set in previous code using: c = cell.Column I'm trying to write the code so that it will select a range that will match the column set by the variable (in this case is column 142 + 2, and row 2. I believe this is somewhere around EL2. How can I change the code so that it will select the range using the column number reference instead of the letter reference? Thanks, Paul |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
replace with 142+2 your variable in the formula
Cells(2, 142 + 2).Select -- Gary "PCLIVE" wrote in message ... I know this code isn't correct, but it's what I've got so far. Range((c + 2) & "2").Select "c" is a variable in which was set in previous code using: c = cell.Column I'm trying to write the code so that it will select a range that will match the column set by the variable (in this case is column 142 + 2, and row 2. I believe this is somewhere around EL2. How can I change the code so that it will select the range using the column number reference instead of the letter reference? Thanks, Paul |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That's what I was looking for. I was close while I was waiting for a reply.
Another quesiton. How could I select a range of cells the same way. I've tried this which didn't work. Range(Cells(2, c + 3)) & ":" & (Cells(50, c + 4)).Select Thanks again, Paul "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... replace with 142+2 your variable in the formula Cells(2, 142 + 2).Select -- Gary "PCLIVE" wrote in message ... I know this code isn't correct, but it's what I've got so far. Range((c + 2) & "2").Select "c" is a variable in which was set in previous code using: c = cell.Column I'm trying to write the code so that it will select a range that will match the column set by the variable (in this case is column 142 + 2, and row 2. I believe this is somewhere around EL2. How can I change the code so that it will select the range using the column number reference instead of the letter reference? Thanks, Paul |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
like this
Range(Cells(2, c + 3), Cells(50, c + 4)).Select -- Gary "PCLIVE" wrote in message ... That's what I was looking for. I was close while I was waiting for a reply. Another quesiton. How could I select a range of cells the same way. I've tried this which didn't work. Range(Cells(2, c + 3)) & ":" & (Cells(50, c + 4)).Select Thanks again, Paul "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... replace with 142+2 your variable in the formula Cells(2, 142 + 2).Select -- Gary "PCLIVE" wrote in message ... I know this code isn't correct, but it's what I've got so far. Range((c + 2) & "2").Select "c" is a variable in which was set in previous code using: c = cell.Column I'm trying to write the code so that it will select a range that will match the column set by the variable (in this case is column 142 + 2, and row 2. I believe this is somewhere around EL2. How can I change the code so that it will select the range using the column number reference instead of the letter reference? Thanks, Paul |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks again Gary.
That did the trick. Paul "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... like this Range(Cells(2, c + 3), Cells(50, c + 4)).Select -- Gary "PCLIVE" wrote in message ... That's what I was looking for. I was close while I was waiting for a reply. Another quesiton. How could I select a range of cells the same way. I've tried this which didn't work. Range(Cells(2, c + 3)) & ":" & (Cells(50, c + 4)).Select Thanks again, Paul "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... replace with 142+2 your variable in the formula Cells(2, 142 + 2).Select -- Gary "PCLIVE" wrote in message ... I know this code isn't correct, but it's what I've got so far. Range((c + 2) & "2").Select "c" is a variable in which was set in previous code using: c = cell.Column I'm trying to write the code so that it will select a range that will match the column set by the variable (in this case is column 142 + 2, and row 2. I believe this is somewhere around EL2. How can I change the code so that it will select the range using the column number reference instead of the letter reference? Thanks, Paul |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One more way:
Cells(2, c + 3).resize(49,2).select PCLIVE wrote: That's what I was looking for. I was close while I was waiting for a reply. Another quesiton. How could I select a range of cells the same way. I've tried this which didn't work. Range(Cells(2, c + 3)) & ":" & (Cells(50, c + 4)).Select Thanks again, Paul "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... replace with 142+2 your variable in the formula Cells(2, 142 + 2).Select -- Gary "PCLIVE" wrote in message ... I know this code isn't correct, but it's what I've got so far. Range((c + 2) & "2").Select "c" is a variable in which was set in previous code using: c = cell.Column I'm trying to write the code so that it will select a range that will match the column set by the variable (in this case is column 142 + 2, and row 2. I believe this is somewhere around EL2. How can I change the code so that it will select the range using the column number reference instead of the letter reference? Thanks, Paul -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave,
Thanks for the reply. I've already gotten code that works. However, I was curious about your suggestion. In your code, what does "resize(49,2)" do? Thanks, Paul "Dave Peterson" wrote in message ... One more way: Cells(2, c + 3).resize(49,2).select PCLIVE wrote: That's what I was looking for. I was close while I was waiting for a reply. Another quesiton. How could I select a range of cells the same way. I've tried this which didn't work. Range(Cells(2, c + 3)) & ":" & (Cells(50, c + 4)).Select Thanks again, Paul "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... replace with 142+2 your variable in the formula Cells(2, 142 + 2).Select -- Gary "PCLIVE" wrote in message ... I know this code isn't correct, but it's what I've got so far. Range((c + 2) & "2").Select "c" is a variable in which was set in previous code using: c = cell.Column I'm trying to write the code so that it will select a range that will match the column set by the variable (in this case is column 142 + 2, and row 2. I believe this is somewhere around EL2. How can I change the code so that it will select the range using the column number reference instead of the letter reference? Thanks, Paul -- Dave Peterson |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It takes the original range and changes the size of it.
..resize(x,y) says to make the new range x number of rows deep by y numbers of columns wide. VBA's help has more information if you want it. ps. There's also a .offset(x,y) property that can be used to "Move" to a different range based on the original range and those x,y values. PCLIVE wrote: Dave, Thanks for the reply. I've already gotten code that works. However, I was curious about your suggestion. In your code, what does "resize(49,2)" do? Thanks, Paul "Dave Peterson" wrote in message ... One more way: Cells(2, c + 3).resize(49,2).select PCLIVE wrote: That's what I was looking for. I was close while I was waiting for a reply. Another quesiton. How could I select a range of cells the same way. I've tried this which didn't work. Range(Cells(2, c + 3)) & ":" & (Cells(50, c + 4)).Select Thanks again, Paul "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... replace with 142+2 your variable in the formula Cells(2, 142 + 2).Select -- Gary "PCLIVE" wrote in message ... I know this code isn't correct, but it's what I've got so far. Range((c + 2) & "2").Select "c" is a variable in which was set in previous code using: c = cell.Column I'm trying to write the code so that it will select a range that will match the column set by the variable (in this case is column 142 + 2, and row 2. I believe this is somewhere around EL2. How can I change the code so that it will select the range using the column number reference instead of the letter reference? Thanks, Paul -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I lost the highlight color when selecting a range, column or row. | Excel Discussion (Misc queries) | |||
Selecting the correct number from a range of cells | Excel Worksheet Functions | |||
after selecting 50 rows of a column i can't reference the cells in the rows | New Users to Excel | |||
Selecting specific row/column from a named range | Excel Worksheet Functions | |||
reference to column (not known) and certain row number | Excel Programming |