Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Overlay/backgrounds | Excel Worksheet Functions | |||
Overlay bar charts | Charts and Charting in Excel | |||
Is it possible to overlay one chart on top of another | Charts and Charting in Excel | |||
Copy the entire sheet to overlay existing sheet? | New Users to Excel | |||
IMAGE OVERLAY | Excel Programming |