Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Matching two worksheet?
Hi
I have two excel worksheets both worksheet contain one column that have same data. I want to bring extra column from worksheet # 2 to put side by side in worksheet # 1 base on first column (that have same data eg Commune Name) Is there a way to match or merge these two worksheet? SF |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Matching two worksheet?
I place the item found on sheet 2 but weren't on Sheet 1 and the end of the
list. Try the code. Sub combinesheets() With Sheets("Sheet1") LastRowSh1 = _ .Cells(Rows.Count, "A").End(xlUp).Row Set Sh1Range = .Range(.Cells(1, "A"), _ .Cells(LastRowSh1, "A")) End With With Sheets("Sheet2") LastRowSh2 = _ .Cells(Rows.Count, "A").End(xlUp).Row Set Sh2Range = .Range(.Cells(1, "A"), _ .Cells(LastRowSh1, "A")) For Each cell In Sh2Range Set c = Sh1Range.Find(what:=cell, _ LookIn:=xlValues) If Not c Is Nothing Then c.Offset(0, 1) = cell Else Sheets("Sheet1"). _ Cells(LastRowSh1 + 1, "B") = _ cell LastRowSh1 = LastRowSh1 + 1 End If Next cell End With End Sub "SF" wrote: Hi I have two excel worksheets both worksheet contain one column that have same data. I want to bring extra column from worksheet # 2 to put side by side in worksheet # 1 base on first column (that have same data eg Commune Name) Is there a way to match or merge these two worksheet? SF |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Finding matching numbers from 1 worksheet in another and with a tw | Excel Discussion (Misc queries) | |||
matching data on worksheet | Excel Discussion (Misc queries) | |||
Matching name from one worksheet to another | Excel Worksheet Functions | |||
Matching data from one worksheet to another. | Excel Discussion (Misc queries) | |||
Search & match more than one worksheet and matching cells. | Excel Worksheet Functions |