Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Range Copy Problem

On Fri, 3 Sep 2004 11:03:12 -0700, "asmenut"
wrote:

I am having some problems when I try to copy a range on one sheet to the same
range on other sheets. The range(s) that I am copying are merged cells but
when I copy the range, it blows the merge away.

Sub CopyData)
Dim i as Integer
Dim SheetCount as Integer

SheetCount = ActiveWorkbook.Sheets.Count
for i = 1 to SheetCount

Range("F1:I2").Copy (Sheets(i).Range("F1:I2"))

Next i

End Sub.


The problem seems connected to the fact that you, during the copy
process, also copy with the same source range and destination range,
i.e. on the same sheet. For those destination sheets that come before
the source sheet the copying works as you want, but once the data has
been copied on itself the cell merging is destroyed on the source
sheet and on all sheets following it.

Try putting this at the begining of your copy statement

If Not Sheets(i) Is ActiveSheet Then

Hope this helps

Lars-Åke



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 a Range from each workbook - Ron de Bruin VBA - a problem Philip[_2_] Excel Worksheet Functions 5 March 11th 07 06:07 AM
Copy range content as picture - truncation problem Jon Peltier[_8_] Excel Programming 0 July 22nd 04 09:17 PM
Copy range content as picture - truncation problem Ron de Bruin Excel Programming 0 July 22nd 04 01:27 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM
Range COPY function - how to copy VALUES and not formulas James Cooke Excel Programming 1 August 21st 03 07:04 PM


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