"Mike Middleton" <mike@mikemiddleton.com> wrote in message
> As I recall, in Excel 97, I had to use three separate Copy and Paste
> commands: one for cell values, one for cell formats, and one for column
> widths.
I'll stand corrected but I don't think Excel 97 has any facility to paste
column widths unless an entire sheet is copied to a new sheet. There is of
course PasteSpecial that can paste values or formats and some other things,
but not row/column dim's.
Regards,
Peter T
Dave Peterson - 14 May 2008 12:36 GMT
I think xl2k added:
range.pastespecial paste:=xlPasteColumnWidths
And it even had a bug. MS didn't create that constant--except in the help. In
xl2k, you would have to use:
range.pastespecial paste:=8
> "Mike Middleton" <mike@mikemiddleton.com> wrote in message
>
[quoted text clipped - 9 lines]
> Regards,
> Peter T

Signature
Dave Peterson
Peter T - 14 May 2008 13:06 GMT
Indeed it was introduced in XL2000 but it's not even documented in XL2000's
help at all
"Paste Optional Variant. The part of the range to be pasted. Can be one of
the following XlPasteType constants: xlPasteAll, xlPasteFormulas,
xlPasteValues, xlPasteFormats, xlPasteNotes, or xlPasteAllExceptBorders. The
default value is xlPasteAll."
This works in xl2k but fails in xl97
range.pastespecial paste:=xlPasteColumnWidths
However, in XL97 if entire columns are copied then Pastespecial formats will
paste column widths. That requires of course that the destination is one or
same number of columns as the source.
Regards,
Peter T
>I think xl2k added:
> range.pastespecial paste:=xlPasteColumnWidths
[quoted text clipped - 20 lines]
>> Regards,
>> Peter T
Peter T - 14 May 2008 13:18 GMT
Weird, in XL2k a recorded macro returns -
Selection.PasteSpecial Paste:=xlColumnWidths ' etc
But it fails on playback as the named constant is not found
Regards,
Peter T
> Indeed it was introduced in XL2000 but it's not even documented in
> XL2000's help at all
[quoted text clipped - 40 lines]
>>> Regards,
>>> Peter T
Dave Peterson - 14 May 2008 15:44 GMT
Try using:
Selection.PasteSpecial Paste:=8
> Weird, in XL2k a recorded macro returns -
>
[quoted text clipped - 53 lines]
> >>
> >> Dave Peterson

Signature
Dave Peterson
Peter T - 14 May 2008 16:23 GMT
Hi Dave,
> Try using:
> Selection.PasteSpecial Paste:=8
Yes that works, it's just odd that somehow the macro recorder returns the
named constant that's not recognized by xl2k's VBA.
A couple of posts back this
> > > This works in xl2k but fails in xl97
> > > range.pastespecial paste:=xlPasteColumnWidths
should have read
This works in xl2k but fails in xl97
range.pastespecial paste:=8
Regards,
Peter T
> Try using:
> Selection.PasteSpecial Paste:=8
[quoted text clipped - 56 lines]
> > >>
> > >> Dave Peterson
Dave Peterson - 14 May 2008 16:52 GMT
I think that even MS would acknowledge this as a bug in xl2k.
> Hi Dave,
>
[quoted text clipped - 87 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Mike Middleton - 14 May 2008 19:28 GMT
Peter T -
I'll stand corrected, too.
I was likely using separate column autofits instead of column width pastes.
- Mike
> "Mike Middleton" <mike@mikemiddleton.com> wrote in message
>
[quoted text clipped - 10 lines]
> Regards,
> Peter T