#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default End(xlDown)

Excellent! Thank you Rick, I'm glad I made this querie, the response has been
fantastic!

"Rick Rothstein" wrote:

lngLastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
Range("b1").Offset(lngLastRow, 0).Select


You might find this interesting... this single line of code will accomplish
the same thing your two lines of code do...

ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Offset(1).Select

The outcome from this part of the statement...

ActiveSheet.Cells(Rows.Count, "B").End(xlUp)

is a Range (actually, a single cell... the last cell in Column B with data
in it), so you can use Offset to move down one row and then select it.

--
Rick (MVP - Excel)


"Normek" wrote in message
...
Thanks Jacob Skaria,

That was very helpful and answered the second part of my question here is
what I came up with:

Sub SelectCell()
lngLastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
Range("b1").Offset(lngLastRow, 0).Select
End Sub

The first part was indirectly answered by smartin in a previous post
today
called
" How to count number of rows with data?"

Here is what I came up with:

Sub CntCells()
ans = Application.WorksheetFunction.CountA(Range(Range(" B2"),
Range("B2").End(xlDown)))
MsgBox ans
End Sub

Thanks to both of you!



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
End(xlDown) function John[_140_] Excel Programming 3 May 11th 09 12:06 AM
A1:B(xlDown)? Simon[_2_] Excel Programming 5 July 29th 08 10:23 AM
End(xlDown) not working? RAHokie Excel Discussion (Misc queries) 2 January 19th 07 12:40 AM
End(xldown) not always going to last cell? Duncan[_5_] Excel Programming 6 May 4th 06 10:30 AM
repeated end(xldown) R.VENKATARAMAN Excel Programming 6 December 28th 05 06:43 PM


All times are GMT +1. The time now is 10:37 PM.

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

About Us

"It's about Microsoft Excel"