LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Copy/Paste with format/style

I'm trying to copy/paste a range from a sheet (the only sheet) in one
workbook to a sheet in a different workbook. Almost everything works,
except that I lose all the formatting applied to different cells within the
range.

The section of code I've got looks like this:

Workbooks.Open Filename:=strFile
Windows(strFile).Activate
'Select section of WBS report containing required data
'and copy to this sheet, starting at the next empty cell in Column B
Range("B5:I5").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows(strWorkbookName).Activate
Range("B1").Select
'move to next blank cell
Selection.End(xlDown).Select
ActiveCell.Offset(1).Select
ActiveSheet.Paste
Application.CutCopyMode = False

I've tried using ActiveSheet.PasteSpecial xlAll, but that doesn't help.

I suspect that what I need to do to get the formatting across is to actually
copy the worksheet I'm copying from into the other workbook, copy between
the sheets, then delete the copied worksheet.

Is this the way to go, or have I missed something blindingly obvious?

Note: I'm actually an Access developer, so I'm not overly familiar with the
Excel object model, and the various properties and methods available. Any
hints on cleaner coding for what I'm doing would also be appreciated.

TIA,

Rob

 
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
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
Changing from format style to list style B.W. Excel Worksheet Functions 1 November 22nd 06 07:53 PM
Copy and Paste in certain format sa02000 Excel Worksheet Functions 3 March 25th 06 06:04 AM
format changes after copy/paste [email protected] Excel Discussion (Misc queries) 2 March 2nd 06 08:28 AM
How copy format, font, color and border without copy/paste? Michel[_3_] Excel Programming 1 November 5th 03 04:43 PM


All times are GMT +1. The time now is 02:37 PM.

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

About Us

"It's about Microsoft Excel"