Copy Column Widths to New Sheet

Mozzz

Board Regular
Joined
May 30, 2011
Messages
66
When I run this code it doesn't copy the column widths to the new sheet. It appears to be copying the wrap text but not the column widths. Sheets(1) is Tab delimited Data out of our Computer System.

[CODE' Updated 8-19-11, Idlse Inventory from RPX Adp - WIT-FI
' Change Titles and Set Columns
Cells.EntireColumn.AutoFit
Cells(1, 15) = "SVC WARR EXP DATE"
With Columns("O:Q")
.ColumnWidth = 10
.HorizontalAlignment = xlCenter
.WrapText = True
End With
' Post Data Lease Units
Range("A2").AutoFilter _
Field:=1, Criteria1:="16100"
Sheets.Add(After:=Sheets(1)).Name = "Lease"
With Sheets(1)
.Range(.Cells(1, 2), .Cells.SpecialCells(xlLastCell)).Copy _
Destination:=Sheets(2).Range("A1")
End With][/CODE]

Any Suggestions?

Thanks,

Mozzz
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
add these extra lines before the 'end with'

Code:
    .Rows("1:1").Copy
    Sheets("Sheet2").Rows("1:1").PasteSpecial Paste:=xlPasteColumnWidths
 
Upvote 0
Since I am not copying the first column of the activesheet I ran into a little problem with Rows("1:1"). I just used Range instead and it works great. Thanks for getting me going in the right directions.

Thanks again,

Mozzz
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,704
Members
452,938
Latest member
babeneker

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