PasteSpecial Paste:=ColumnWidths

  • Thread starter Thread starter Arvi Laanemets
  • Start date Start date
A

Arvi Laanemets

Hi

When I record PasteSpecial operation as macro, I get a code like this:
Range(RangeToCopy).Select
Selection.Copy
Range(RangeToPaste).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Selection.PasteSpecial Paste:=xlColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

As I prefer to work wihout pouncing around with cursor, my code looks like
this instead:
Range(RangeToCopy).Copy
Range(RangeToPaste).PasteSpecial Paste:=xlValues
Range(RangeToPaste).PasteSpecial Paste:=xlFormats
' so long it works fine, but next row of code does fail
Range(RangeToPaste).PasteSpecial Paste:=xlColumnWidths

I think, that like with copying the validation, where I have to use an index
6 instead of optional variant's name , I need some index here too. Has
someone some knowledge about this - in Excel Help I didn't find anything
useful about this matter.

Thanks in advance
 
Importent : because of another Bug

First pastespecial the ColumnWidths then the values and formats in the code
 
Back
Top