Paste Column Width Language

G

Guest

This does not work:

Workbooks("Hot List.xls").Sheets("Snapshot").Cells.Copy
ThisWorkbook.Sheets(ShName).Range("A1").PasteSpecial xlColumnWidths

But this does:
Workbooks("Hot List.xls").Sheets("Snapshot").Cells.Copy
ThisWorkbook.Sheets(ShName).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

is the command in the first code excerpt not xlColumnWidths?

thanks...

Steve
 
G

Guest

SteveC, did you ever get a good answer to your question? I've been hunting
for an answer to this myself. I found that if you record a macro where you
cut and PasteSpecial the column widths, the CODE GENERATED BY EXCEL generates
a "Variable not defined" error referring to xlColumnWidths when I try to run
it again! How can code generated by Excel's own macro recorder, contain
errors? It's baffling!
 
R

Ron de Bruin

Excel 2000 ?

There is a bug in the version

I always use the numner 8

PasteSpecial 8

Working in all Excel versions

Same problem for validation as far as I know (use 6 for that)
 
G

Guest

Holy cow, it works! Thanks a lot.

Ron de Bruin said:
Excel 2000 ?

There is a bug in the version

I always use the numner 8

PasteSpecial 8

Working in all Excel versions

Same problem for validation as far as I know (use 6 for that)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top