Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy but don't overlay


Is there a way via a macro to copy the values in a range of cells t
another range of cells, but if there is anything in the destinatio
range of cells, do not overlay with the values you are copying from?

Consolidating would work, except I would need my destination cell rang
to be one of the consolidation cell ranges

--
mwc091
-----------------------------------------------------------------------
mwc0914's Profile: http://www.excelforum.com/member.php...fo&userid=2413
View this thread: http://www.excelforum.com/showthread.php?threadid=37943

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy but don't overlay


Code:
--------------------
Dim rng1 As Range
Dim rng2 As Range
Set rng1 = Range("A1:B50") ' Your copy range
Set rng2 = Range("C1:D50") ' Your paste range
For Each x In rng2.Cells
If x.Value < "" Then Exit Sub
Next x
rng1.Copy
rng2.PasteSpecial xlPasteAll
--------------------


HTH


--
tkstock


------------------------------------------------------------------------
tkstock's Profile: http://www.excelforum.com/member.php...o&userid=14443
View this thread: http://www.excelforum.com/showthread...hreadid=379439

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy but don't overlay


Thanks, but it did not work.

I have attached an example spreadsheet with the macro in it. Maybe I a
missing something. I want to be able to copy cells E1:G3 to A1:C3 bu
not overlay what is already in cell A1:C1

+-------------------------------------------------------------------
|Filename: example.zip
|Download: http://www.excelforum.com/attachment.php?postid=3504
+-------------------------------------------------------------------

--
mwc091
-----------------------------------------------------------------------
mwc0914's Profile: http://www.excelforum.com/member.php...fo&userid=2413
View this thread: http://www.excelforum.com/showthread.php?threadid=37943

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy but don't overlay


Code:
--------------------
Dim rng1 As Range
Dim rng2 As Range
Set rng1 = Range("e1:g3") ' Your copy range
Set rng2 = Range("a1:c3") ' Your paste range
r1 = rng1.Rows.Count
c1 = rng1.Columns.Count

For i = 1 To r1
For j = 1 To c1
If rng2.Cells(i, j) = "" Then
rng2.Cells(i, j) = rng1.Cells(i, j)
End If
Next j
Next i
--------------------


That work for you? I thought if your paste range contained ANYTHING
you didn't want to paste anything. If you are just filling in, this
should work.


--
tkstock


------------------------------------------------------------------------
tkstock's Profile: http://www.excelforum.com/member.php...o&userid=14443
View this thread: http://www.excelforum.com/showthread...hreadid=379439

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy but don't overlay


Got it....many thank

--
mwc091
-----------------------------------------------------------------------
mwc0914's Profile: http://www.excelforum.com/member.php...fo&userid=2413
View this thread: http://www.excelforum.com/showthread.php?threadid=37943

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
Overlay/backgrounds Janelle Blecka Excel Worksheet Functions 1 June 18th 08 08:35 AM
Overlay bar charts glennr Charts and Charting in Excel 1 November 8th 06 09:13 AM
Is it possible to overlay one chart on top of another Curtis Charts and Charting in Excel 4 October 17th 06 11:01 PM
Copy the entire sheet to overlay existing sheet? LurfysMa New Users to Excel 2 August 29th 05 07:05 PM
IMAGE OVERLAY ej_user Excel Programming 0 October 22nd 04 02:56 PM


All times are GMT +1. The time now is 03:34 PM.

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"