Last column


Posted by TomC on June 14, 2000 12:23 PM

I also need to re-size the last two columns in my pivot table after I change the font. I can locate the last column but I'm having problems selecting it so I can autofit it. This is the code I'm using to locate the column:

LastCol = ActiveCell.SpecialCells(xlLastCell).Column

I tried these methods to re-size it but they both get errors:

Range(LastCol, LastCol).EntireColumn.AutoFit
Columns("LastCol:LastCol").EntireColumn.AutoFit

Any help would be appreciated. Thanks!



Posted by Ryan on June 16, 0100 3:46 PM

Here is the proper syntax, took me a little while to figure it out, but this works. Hope it works. Let me know.
Ryan

Columns(LastCol).Columns.AutoFit