impactblu
impactblu

Reputation: 107

excel paste special function in vba not pasting cell widths

I'm running a macro to copy from one sheet and past to another however, it is not pasting the cell width. If I do this manually it works i.e. copy the column and paste special > all. the vba code for the macro is located here: http://pastebin.com/K2sW1C8x

as you can see i'm using :

Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _False, Transpose:=False

Upvotes: 0

Views: 8882

Answers (1)

chuff
chuff

Reputation: 5866

The paste of the column widths need to be done in a separate action:

  Selection.PasteSpecial Paste:=xlColumnWidths

This command occasionally threw an error in previous versions of Excel. If you get an error, use the number 8 in place of xlColumnwidths.

Upvotes: 3

Related Questions