View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Arvi Laanemets Arvi Laanemets is offline
external usenet poster
 
Posts: 510
Default PasteSpecial Paste:=ColumnWidths

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

--
When sending mail, use address arvil<attarkon.ee
Arvi Laanemets