Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default copy paste (column width prb)

Hello all

I have a summary sheet. I want to copy that summary sheet to another
workbook. I have written the code below but there is something missing
"Column widths". The new sheets column widths are not the same as the master
sheet. How can I make the new sheets column widhts same the the master one.

thanx all
Murat Demir HEKİMOĞLU

Sub new_excel()

Dim appPATH As String, myPATH As String
Dim pName As String, strSave As String

appPATH = ActiveWorkbook.FullName
myPATH = ActiveWorkbook.Path
pName = ActiveWorkbook.Name

On Error GoTo ErrRoutine

Worksheets("sheet_name").Range("A1:Q50").Copy

Set NewBook = Workbooks.Add
fName = "Summary_" & Day(Date) & "_" & Month(Date) & "_" & Year(Date) & "_"
& pName

Sheets(1).Range("A1").PasteSpecial Paste:=xlValues
Sheets(1).Range("A1").PasteSpecial Paste:=xlFormats

Sheets(1).Name = "SUMMARY"
Sheets(1).Range("A1").Select

Application.DisplayAlerts = False

strSave = myPATH & "\" & fName
NewBook.SaveAs strSave

GoTo ExitRoutine

ErrRoutine:
MsgBox Err.Number & ": " & Err.Description
Resume ExitRoutine

ExitRoutine:
Application.DisplayAlerts = True
Exit Sub

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default copy paste (column width prb)

Hi Murat,
Sheets(1).Range("A1").PasteSpecial Paste:=xlValues
Sheets(1).Range("A1").PasteSpecial Paste:=xlFormats



There is a BUG in excel with paste special:

You should be able to use
Sheets(1).Range("A1").PasteSpecial Paste:=xlPasteColumnWidths

HOWEVER, this does not work, so you have to use
Sheets(1).Range("A1").PasteSpecial Paste:=8
instead.

regards

arno


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default copy paste (column width prb)

arno wrote:
There is a BUG in excel with paste special:
Sheets(1).Range("A1").PasteSpecial Paste:=xlPasteColumnWidths
Sheets(1).Range("A1").PasteSpecial Paste:=8



hmmm. Appears to be gone with Excel 2002 (XP). But you have to use
Paste:=8 for Excel 2000 for sure.

arno


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I copy row height like i copy column width? Markman Excel Discussion (Misc queries) 1 April 3rd 09 01:54 AM
Copy Column width robert morris Excel Discussion (Misc queries) 3 October 13th 07 04:28 PM
Copy column width along with data?? JR Hester Excel Discussion (Misc queries) 4 September 20th 07 09:06 PM
copy formats column width & row heights between Excel WORKSHEETS? tccc1219 Excel Discussion (Misc queries) 5 November 8th 05 04:22 PM


All times are GMT +1. The time now is 02:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"