ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Paste Column Width Language (https://www.excelbanter.com/excel-programming/383860-paste-column-width-language.html)

stevec

Paste Column Width Language
 
This does not work:

Workbooks("Hot List.xls").Sheets("Snapshot").Cells.Copy
ThisWorkbook.Sheets(ShName).Range("A1").PasteSpeci al 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

Mike Fogleman

Paste Column Width Language
 
It seems to be xlPasteColumnWidths.

Mike F
"SteveC" wrote in message
...
This does not work:

Workbooks("Hot List.xls").Sheets("Snapshot").Cells.Copy
ThisWorkbook.Sheets(ShName).Range("A1").PasteSpeci al 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




stevec

Paste Column Width Language
 
ah, thanks

"Mike Fogleman" wrote:

It seems to be xlPasteColumnWidths.

Mike F
"SteveC" wrote in message
...
This does not work:

Workbooks("Hot List.xls").Sheets("Snapshot").Cells.Copy
ThisWorkbook.Sheets(ShName).Range("A1").PasteSpeci al 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





[email protected]

Paste Column Width Language
 
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!

"SteveC" wrote:

ah, thanks

"Mike Fogleman" wrote:

It seems to be xlPasteColumnWidths.

Mike F
"SteveC" wrote in message
...
This does not work:

Workbooks("Hot List.xls").Sheets("Snapshot").Cells.Copy
ThisWorkbook.Sheets(ShName).Range("A1").PasteSpeci al 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





Ron de Bruin

Paste Column Width Language
 
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)

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


" wrote in message
...
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!

"SteveC" wrote:

ah, thanks

"Mike Fogleman" wrote:

It seems to be xlPasteColumnWidths.

Mike F
"SteveC" wrote in message
...
This does not work:

Workbooks("Hot List.xls").Sheets("Snapshot").Cells.Copy
ThisWorkbook.Sheets(ShName).Range("A1").PasteSpeci al 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





[email protected]

Paste Column Width Language
 
Holy cow, it works! Thanks a lot.

"Ron de Bruin" wrote:

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)

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


" wrote in message
...
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!

"SteveC" wrote:

ah, thanks

"Mike Fogleman" wrote:

It seems to be xlPasteColumnWidths.

Mike F
"SteveC" wrote in message
...
This does not work:

Workbooks("Hot List.xls").Sheets("Snapshot").Cells.Copy
ThisWorkbook.Sheets(ShName).Range("A1").PasteSpeci al 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







All times are GMT +1. The time now is 01:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com