Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Select the end of a row plus 1

Sorry Bob- many thanks to you too!!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA: Column Select then Data Select then return to cell A1 James C[_2_] Excel Discussion (Misc queries) 3 February 1st 10 11:35 AM
Macro to select cells without a certain value and select a menu it Guy[_2_] Excel Worksheet Functions 9 January 2nd 09 05:21 PM
Using formulas to select cells (Ex: Select every nth cell in a col Lakeview Photographic Services Excel Discussion (Misc queries) 2 March 15th 07 02:17 PM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 4th 05 11:59 PM
Select other workbook to select data in a macro. T Tromp Excel Programming 2 September 19th 03 01:43 PM


All times are GMT +1. The time now is 05:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"