Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Merging 2 sheets.
I'll be the first to admit that this is a simple problem, but I can't seem
to get beyond the brain-fart I'm having today... I have 2 sheets, call them (most imaginatively) sheet1 and sheet2. Column A in sheet1 is a series of unique numbers. Column E in sheet2 is a series of numbers (non-unique). Both sheets are sorted on those columns, in the event it makes life easier. All of the numbers in sheet1 also exist in sheet2 but the reverse is not true. Each time a number appears in sheet2/colE that matches a number in sheet1/ colA, I want to copy the values in sheet1/colB thru colE into sheet2/cOlG thru colJ. Clear as mud? Thanks! Bruce |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Merging 2 sheets.
Something like this...
'--- Sub BreadcrumbWaggles() 'Jim Cone - Portland, Oregon - October 2011 Dim rngColumnOne As Range Dim rngColumnTwo As Range Dim rngFound As Range Dim rCell As Range Set rngColumnOne = Worksheets(1).Range("A1:A20").Cells Set rngColumnTwo = Worksheets(2).Range("E1:E20").Cells For Each rCell In rngColumnTwo On Error Resume Next Set rngFound = rngColumnOne.Cells(Application.WorksheetFunction.M atch(rCell, rngColumnOne, 0), 1) On Error GoTo 0 If Not rngFound Is Nothing Then rCell.Resize(1, 4).Offset(0, 2).Value = rngFound.Resize(1, 4).Offset(0, 1).Value Set rngFound = Nothing End If Next End Sub '--- Jim Cone Portland, Oregon USA http://www.contextures.com/excel-sort-addin.html (editorial review of special sort excel add-in (30 ways to sort) "Bruce Bowler" wrote in message ... I'll be the first to admit that this is a simple problem, but I can't seem to get beyond the brain-fart I'm having today... I have 2 sheets, call them (most imaginatively) sheet1 and sheet2. Column A in sheet1 is a series of unique numbers. Column E in sheet2 is a series of numbers (non-unique). Both sheets are sorted on those columns, in the event it makes life easier. All of the numbers in sheet1 also exist in sheet2 but the reverse is not true. Each time a number appears in sheet2/colE that matches a number in sheet1/ colA, I want to copy the values in sheet1/colB thru colE into sheet2/cOlG thru colJ. Clear as mud? Thanks! Bruce |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
merging sheets | Excel Discussion (Misc queries) | |||
merging sheets | Excel Worksheet Functions | |||
merging sheets | Excel Programming | |||
merging sheets | Excel Discussion (Misc queries) | |||
merging sheets | Excel Worksheet Functions |