You used column B to find the last row.
Can you pick out a row to find the last column (maybe row 1 has headers???):
dim LastRow as long
dim LastCol as long
With worksheets(1)
lastrow = .Cells(Rows.Count, 2).End(xlUp).Row
lastcol = .cells(1,.columns.count).end(xltoleft).column
end with
Ray wrote:
>
> Can anyone provide the syntax for counting the number of columns containing
> data in an unknown range? The row.count syntax is:
> lastrow = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> lastcolumn=???
>
> I need to find the last column with data in a worksheet that could contain
> any number of columns.
> --
> Ray
--
Dave Peterson
|