![]() |
find last column with data
I have a file that at times will have various number of columns. How do I
find the last column with data. All rows will have data in the same columns. I am starting at A2 |
find last column with data
hi
try somedthing like this...... Sub findcol() Dim c As Long c = Cells(1, Columns.Count).End(xlToLeft).Column MsgBox "The Last column is " & Cells(1, c).Address 'Cells(1, c).Select 'optional End Sub regards FSt1 "thomas donino" wrote: I have a file that at times will have various number of columns. How do I find the last column with data. All rows will have data in the same columns. I am starting at A2 |
find last column with data
here's a solution from rick rothstein:
LastUsedRow = ActiveSheet.Cells.Find(What:="*", SearchOrder:=xlRows, _ SearchDirection:=xlPrevious).Row LastUsedCol = ActiveSheet.Cells.Find(What:="*", SearchOrder:=xlColumns, _ SearchDirection:=xlPrevious).Column -- Gary Keramidas Excel 2003 "FSt1" wrote in message ... hi try somedthing like this...... Sub findcol() Dim c As Long c = Cells(1, Columns.Count).End(xlToLeft).Column MsgBox "The Last column is " & Cells(1, c).Address 'Cells(1, c).Select 'optional End Sub regards FSt1 "thomas donino" wrote: I have a file that at times will have various number of columns. How do I find the last column with data. All rows will have data in the same columns. I am starting at A2 |
All times are GMT +1. The time now is 12:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com