Find last col with data
Data is inserted by a server into a template sheet. My
code copies filtered rows to new sheets and creates
PivotTables. This works fine as long as all 20 columns
contain data.
However, if only col 1 - n have data then an error
message says something like "more than one row is
needed". (Col headings on row one are always filled).
So my question is: how can I replace "20" in the code
below with the number of the last col used for data.
(Cols are always filled left to right).
Set rng = Range(Cells(1, 1), Cells(Rows.Count, 20).End
(xlUp))
Thanks!
Ulf
|