Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
How can I return the row number (in VB inside a macro) of the last data-containing cell in a particular column? Thanks for any help, Jon |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jon,
Try something like the following: Dim RowNum As Long RowNum = Cells(Rows.Count,"A").End(xlUp).Row Change the "A" to the column of interest. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Jonathan Vickers" wrote in message ... Hi, How can I return the row number (in VB inside a macro) of the last data-containing cell in a particular column? Thanks for any help, Jon |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the help, Chip.
I want to use the result in the next part of the code in place of the 400: Rows("6:400").Sort .............. but it doesn't seem to work. Is there something else that I need to do, or should I be approaching this in another way? Thanks once again for any help, Jon "Chip Pearson" wrote in message ... Jon, Try something like the following: Dim RowNum As Long RowNum = Cells(Rows.Count,"A").End(xlUp).Row Change the "A" to the column of interest. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Jonathan Vickers" wrote in message ... Hi, How can I return the row number (in VB inside a macro) of the last data-containing cell in a particular column? Thanks for any help, Jon |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rows("6:" & rowNum).Sort
demo'd from the immediate window: rowNum = 600 ? Rows("6:" & rowNum).Address $6:$600 -- Regards, Tom Ogilvy "Jonathan Vickers" wrote in message ... Thanks for the help, Chip. I want to use the result in the next part of the code in place of the 400: Rows("6:400").Sort .............. but it doesn't seem to work. Is there something else that I need to do, or should I be approaching this in another way? Thanks once again for any help, Jon "Chip Pearson" wrote in message ... Jon, Try something like the following: Dim RowNum As Long RowNum = Cells(Rows.Count,"A").End(xlUp).Row Change the "A" to the column of interest. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Jonathan Vickers" wrote in message ... Hi, How can I return the row number (in VB inside a macro) of the last data-containing cell in a particular column? Thanks for any help, Jon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return Number | Excel Discussion (Misc queries) | |||
Return the Row number | Excel Discussion (Misc queries) | |||
Return a High Number | Excel Worksheet Functions | |||
How to format number and not return ###### | Excel Worksheet Functions | |||
command to return the row number or cell number in excel? | Excel Programming |