![]() |
getting the column and rows from a selection
I'm using the three lines below to select all of the cells in a worksheet
table that have data. Range("E7").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select This line gives me the row number of the last row in the selection, but I can't figure out how to get the column number of the last column in the selection. cRows = Cells(Rows.Count, "A").End(xlUp).Row Any ideas ? thanks. |
getting the column and rows from a selection
Try this Andy
MsgBox Selection.Cells(Selection.Cells.Count).Column -- Regards Ron de Bruin http://www.rondebruin.nl "Andy K" <Andy wrote in message ... I'm using the three lines below to select all of the cells in a worksheet table that have data. Range("E7").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select This line gives me the row number of the last row in the selection, but I can't figure out how to get the column number of the last column in the selection. cRows = Cells(Rows.Count, "A").End(xlUp).Row Any ideas ? thanks. |
getting the column and rows from a selection
Thanks !!
"Ron de Bruin" wrote: Try this Andy MsgBox Selection.Cells(Selection.Cells.Count).Column -- Regards Ron de Bruin http://www.rondebruin.nl "Andy K" <Andy wrote in message ... I'm using the three lines below to select all of the cells in a worksheet table that have data. Range("E7").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select This line gives me the row number of the last row in the selection, but I can't figure out how to get the column number of the last column in the selection. cRows = Cells(Rows.Count, "A").End(xlUp).Row Any ideas ? thanks. |
All times are GMT +1. The time now is 02:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com