Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
FInd common data in one column then add number in adjacent column | Excel Worksheet Functions | |||
compare data in column A with column B to find duplicates | Excel Discussion (Misc queries) | |||
find data in one column and use data in the next column over Exce | Excel Programming | |||
find rows for unique data in 1 column and different data in other. | Excel Discussion (Misc queries) | |||
Find data in Column D, add L in Column A | Excel Programming |