Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select the end of a row plus 1
Right- first post out of the way and I'm on a roll... I am horribly
stuck on trying to select the cell immediately to the right of a row. I used the following code to select the cell at the bottom of a column (in this case 'B' where the data starts in row 3) Sub Test() Dim y As Long Dim rng As Range Set rng = Range("B3").End(xlDown) y = rng.Row + 1 Range("b" & y).Select End Sub But I got this (applying the same [or so I thought] logic) Sub Test() Dim y As Long Dim rng As Range Set rng = Range("b3").End(xlDown) y = rng.Row + 1 Range("b" & y).Select End Sub But this selects the same cell and +2 selects the cell below +3 the cell below that etc... I'm stuck. Any ideas? Thanks Solomon |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select the end of a row plus 1
Sub Test()
Dim rng As Range Set rng = Range("B3").End(xlDown) rng.offset(1,0).Select 'Next row rng.offset(0,1).Select ' cell to the right rng.offset(-1,0).select ' cell above rng.offset(0,-1).Select 'cell to the left rng.offset(1,1).Select 'cell down 1, to the right 1 End Sub -- Regards, Tom Ogilvy "solomon_monkey" wrote in message oups.com... Right- first post out of the way and I'm on a roll... I am horribly stuck on trying to select the cell immediately to the right of a row. I used the following code to select the cell at the bottom of a column (in this case 'B' where the data starts in row 3) Sub Test() Dim y As Long Dim rng As Range Set rng = Range("B3").End(xlDown) y = rng.Row + 1 Range("b" & y).Select End Sub But I got this (applying the same [or so I thought] logic) Sub Test() Dim y As Long Dim rng As Range Set rng = Range("b3").End(xlDown) y = rng.Row + 1 Range("b" & y).Select End Sub But this selects the same cell and +2 selects the cell below +3 the cell below that etc... I'm stuck. Any ideas? Thanks Solomon |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select the end of a row plus 1
Solomon,
You might be meaning this Set rng = Range("B3").End(xlDown) Set rng = rng.End(xlToRight).Offset(0, 1) -- HTH ------- Bob Phillips "solomon_monkey" wrote in message oups.com... Right- first post out of the way and I'm on a roll... I am horribly stuck on trying to select the cell immediately to the right of a row. I used the following code to select the cell at the bottom of a column (in this case 'B' where the data starts in row 3) Sub Test() Dim y As Long Dim rng As Range Set rng = Range("B3").End(xlDown) y = rng.Row + 1 Range("b" & y).Select End Sub But I got this (applying the same [or so I thought] logic) Sub Test() Dim y As Long Dim rng As Range Set rng = Range("b3").End(xlDown) y = rng.Row + 1 Range("b" & y).Select End Sub But this selects the same cell and +2 selects the cell below +3 the cell below that etc... I'm stuck. Any ideas? Thanks Solomon |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select the end of a row plus 1
Hi Tom,
I've seen your name appear on a load of the answers I found in the groups... many thanks for this... superb info. Cheers, Solomon. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select the end of a row plus 1
Sorry Bob- many thanks to you too!!
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA: Column Select then Data Select then return to cell A1 | Excel Discussion (Misc queries) | |||
Macro to select cells without a certain value and select a menu it | Excel Worksheet Functions | |||
Using formulas to select cells (Ex: Select every nth cell in a col | Excel Discussion (Misc queries) | |||
In Excel 2000, How do you select the whole of a worksheet (Select. | Excel Discussion (Misc queries) | |||
Select other workbook to select data in a macro. | Excel Programming |