…But when you try to do Selection.PasteSpecial Paste:=xlColumnWidths and try to run the macro, Excel say xlColumnWidths is undefined. Strange, since this is what the macro recorder gave me. …
I can honestly say that I’ve never pasted special column widths before. In fact, I didn’t even know it was an option. But Mike did indeed discover a bug that MS describes in KB231090. When I recorded a macro, I got
‘ Macro1 Macro
‘ Macro recorded 6/13/2005 by Dick Kusleika
Selection.PasteSpecial Paste:=xlcolumnwidths, Operation:=xlNone, _
But it looks like the Excel guys forgot to create the constant xlColumnWidths. Use it’s intended literal value, 8, instead, e.g.