I created a macro that, among other things, cycles through the column headings standardizing the heading of relevant columns. I loop through the columns by
This works great with no problems as far as I can tell on most sheets I run it on, but every now and then there are times when it goes all the way to column XFD (which causes problems with the rest of the macro) and I can't figure out why.
Do you have a better method to loop through the populated cells in Row 1? The number of columns changes per sheet based on the source of the data.
Thanks for your help!
VBA Code:
Range("A1").Select
Do Until IsEmpty(ActiveCell)
blah blah blah
ActiveCell(1, 2).Select
Loop
This works great with no problems as far as I can tell on most sheets I run it on, but every now and then there are times when it goes all the way to column XFD (which causes problems with the rest of the macro) and I can't figure out why.
- I'll hit Control + End on the problem sheet and it'll show the last cell is in column AY for example. Run the macro, and Control+End now brings me to column XFD.
- I go one column over from wherever Control + End brings me on the problem sheet, use the immediate window and get a TRUE result from "debug.print IsEmpty(ActiveCell)", yet the macro still runs to column XFD
- I've tried using ASAP Utilities to "Reset Excel's Last Cell" and still get the same result on the problem sheet. Column XFD.
Do you have a better method to loop through the populated cells in Row 1? The number of columns changes per sheet based on the source of the data.
Thanks for your help!