problem with cell sizes

D

derekc

have a question...

i have a button that opens a new book, copy data from one book to th
new one. problem i can seem to solve is when i copy the data from th
first book to the second. it doesnt copy the cell sizes. on the firs
book i have all different sizes of cells, on the second its default
how do i get the cell sizes to change to match the first book.

thanks

-dere
 
G

Grey Newt

The cell sizes are determined by row depths and column widths. Try doing this (manually and/or recorded to put in code) - highlight the entire columns (say A:G), copy, then in the destination sheet highlight the same columns, paste special, paste formats. the yellow paintbrush tool (format painter) in the toolbar is a quicker way of doing this
 
D

derekc

well thaught it worked, im getting an error 1004 when trying to cop
columnwidths, heres what i have

Private Sub CommandButton3_Click()
Range("A1:Q22").Select
Selection.Copy
Workbooks.Add
Selection.Insert Shift:=xlToRight
Selection.PasteSpecial Paste:=xlColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub

i get the error at the selection.pasespecial line
 
Top