Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Only matach two excel spread sheet
I have sheet1 and sheet2 both as SSN on columnA like this
sheet1 111-111-111 222-222-222 333-333-333 sheet2 111-111-111 222-222-222 444-444-444 I would like match on sheet3 showing 111-111-111 222-222-222 how do you write the macro for this? Thanks. Lillian |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Only matach two excel spread sheet
Sub matchsheets()
Sh1RowCount = 1 Sh3RowCount = 1 With Sheets("Sheet1") Do While .Range("A" & Sh1RowCount) < "" SSN = .Range("A" & Sh1RowCount) With Sheets("Sheet2") Set c = .Columns("A:A").Find(what:=SSN, _ LookIn:=xlValues) If Not c Is Nothing Then With Sheets("Sheet3") .Range("A" & Sh3RowCount) = SSN Sh3RowCount = Sh3RowCount + 1 End With End If End With Sh1RowCount = Sh1RowCount + 1 Loop End With End Sub "Lillian Lian" wrote: I have sheet1 and sheet2 both as SSN on columnA like this sheet1 111-111-111 222-222-222 333-333-333 sheet2 111-111-111 222-222-222 444-444-444 I would like match on sheet3 showing 111-111-111 222-222-222 how do you write the macro for this? Thanks. Lillian |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Only matach two excel spread sheet
Thanks Joel, it work, your great
"Joel" wrote: Sub matchsheets() Sh1RowCount = 1 Sh3RowCount = 1 With Sheets("Sheet1") Do While .Range("A" & Sh1RowCount) < "" SSN = .Range("A" & Sh1RowCount) With Sheets("Sheet2") Set c = .Columns("A:A").Find(what:=SSN, _ LookIn:=xlValues) If Not c Is Nothing Then With Sheets("Sheet3") .Range("A" & Sh3RowCount) = SSN Sh3RowCount = Sh3RowCount + 1 End With End If End With Sh1RowCount = Sh1RowCount + 1 Loop End With End Sub "Lillian Lian" wrote: I have sheet1 and sheet2 both as SSN on columnA like this sheet1 111-111-111 222-222-222 333-333-333 sheet2 111-111-111 222-222-222 444-444-444 I would like match on sheet3 showing 111-111-111 222-222-222 how do you write the macro for this? Thanks. Lillian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to create Login & Log out Spread sheet in Excel with automated Attendance sheet | Excel Worksheet Functions | |||
Excel spread sheet | Excel Discussion (Misc queries) | |||
How do I set up a spread sheet in excel | Setting up and Configuration of Excel | |||
how do i enter a bull call spread into the options spread sheet ? | Excel Worksheet Functions | |||
excel spread sheet | Charts and Charting in Excel |