Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default 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
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
merging sheets cufc1210 Excel Discussion (Misc queries) 2 September 16th 09 01:00 PM
merging sheets Osvaldo Excel Worksheet Functions 0 September 16th 06 05:52 AM
merging sheets Osvaldo Excel Programming 0 September 16th 06 05:49 AM
merging sheets b166er Excel Discussion (Misc queries) 1 August 6th 06 06:35 PM
merging sheets b166er Excel Worksheet Functions 0 August 6th 06 05:48 PM


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