problem with cell sizes

  • Thread starter Thread starter derekc
  • Start date Start date
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
 
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
 
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
 

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

Back
Top