Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Blewyn
This will only work with a contiguous range as it is using the COUNTA worksheet function which counts non blank cells, so if you have data in A1:A26 with A16 blank for example, Number_of_rows variable will end up at 25 and so A25 will be activated, when actually it is A26 that is the last cell. I prefer to use Sub test() Range("A65536").End(xlUp).Select End Sub You can equally use any properties or methods of the range object, so replacing Select with Row will return the row number if that is what is desired. People have lots of way of doing this so no way is right or wrong, but generally I have found the way above reliable. (For versions before XL97 you will need to lower the start row to 16384 to account for less rows in these versions) -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS "Blewyn" wrote in message ... Number_of_rows = WorksheetFunction.CountA(Range("A1:A" & Rows.Count)) Cells(Number_of_rows,1).Activate Cheers, Blewyn PS This advice given to me by Ron de Bruin in response to a smiliar question a couple of days ago. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to change German language data into Eglish Language in a colum | Excel Discussion (Misc queries) | |||
language support in excel sheet using a third party language tool | Excel Worksheet Functions | |||
OS language and Office language conflicts | Excel Worksheet Functions | |||
How can I programatically change the language in the language bar? | Excel Discussion (Misc queries) | |||
How to change the excel format from language to language? | Excel Discussion (Misc queries) |