copy/paste "Exact" Formats

RookieMe

New Member
Joined
Jul 27, 2011
Messages
3
I have a source sheet with some empty columns that have a very thin width, when I paste the copied sheet into a new workbook the "thin" columns come in as regular width empty columns. Is it possible to copy & paste exact formats of sheets/columns including the column width?

I tried and
objWorkbook.Worksheets(NewSheet).Range("A1").PasteSpecial Paste=xlPasteFormats
I also tried
objWorkbook.Worksheets(NewSheet).Range("A1").PasteSpecial Paste=xlFormats, Transpose=False
and I tried
objWorkbook.Worksheets(NewSheet).Range("A1").PasteSpecial Paste=xlPasteColumnWidths

Thanks,
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
You seem to be missing :

Rich (BB code):
objWorkbook.Worksheets(NewSheet).Range("A1").PasteSpecial Paste:=xlPasteFormats
objWorkbook.Worksheets(NewSheet).Range("A1").PasteSpecial Paste:=xlPasteColumnWidths
 
Upvote 0
Thanks for the quick response, VoG! I have this code embeded in a vbs file and it does NOT like the ":"... not sure if there's a trick to adding ":' inot the vbs file.

Also, it's worth adding that I'm running MS excel 2007, if that matters.
 
Upvote 0
I assumed that you were working in VBA which is what the code I posted is for. Sorry, I do not know how to do this in VBS.
 
Upvote 0
Ok, I found how to do it..

this will paste the column width
objWorkbook.Worksheets(NewSheet).Range("A1").PasteSpecial 8

followed by this which will paste the values in

objWorkbook.Worksheets(NewSheet).Range(
"A1").PasteSpecial 13
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top