Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Copy/Paste Macro & Formatting Issues

Because of the problem with merged cells and pasting values I'd sugg4est
pasting formulas and then converting them to cvalues. Also I'd suggest
pasting the comments and then clearing them. An example:

Sub a()
Dim Cell As Range
Workbooks("Book1.xls").Activate
Range("A1:C12").Copy
Workbooks("Book2.xls").Activate
ActiveSheet.Paste Range("A1")
Range("A1").PasteSpecial 8
Selection.ClearComments
On Error GoTo ExitThis
For Each Cell In Selection.SpecialCells(xlCellTypeFormulas)
Cell.Value = Cell.Value
Next
ExitThis:
End Sub


--
Jim Rech
Excel MVP
"JimK" wrote in message
...
| Hi,
| I've written a macro that copy/pastes data as values into a new workbook
| (this eliminates formulas and proprietary informtion contained in the
source
| workbook). Is there a straightforward way for me to have the macro copy
over
| all of the graphics, data as values, column widths, formatting and merged
| cell formats BUT not copy over any comments in the cells? I can't just
copy
| over the worksheet, becuase the sorce data is a selected range from the
| source worksheet, not the whole worksheet. Right now, I'm using:
| ActiveSheet.Paste
| Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
| False, Transpose:=False
| Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone,
SkipBlanks:= _
| False, Transpose:=False
| Selection.PasteSpecial 8
| Though probably archaic, this code copies graphics, values, formats and
| column widths. However, it also copies cell comments and the program
| halts/crashes when there are merged cells in the source workbook.
| Any help you can provide would be greatly appreciated. Thanks.


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
Copy and Paste Conditional Formatting igbert Excel Discussion (Misc queries) 3 November 30th 09 05:25 PM
Copy Paste conditional formatting Raz Excel Discussion (Misc queries) 2 October 20th 08 06:32 PM
How do I copy & paste and keep the source formatting? dmk Excel Discussion (Misc queries) 2 August 6th 08 04:52 PM
Macro to Copy/Paste then Paste to Next Line tomkarakowski Excel Programming 1 May 28th 04 01:19 AM
Please Help.. copy,formatting issues Adresmith[_5_] Excel Programming 0 May 6th 04 07:40 PM


All times are GMT +1. The time now is 09:05 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"