Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
SF SF is offline
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
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
Finding matching numbers from 1 worksheet in another and with a tw Evil with a K[_2_] Excel Discussion (Misc queries) 1 August 26th 09 09:29 PM
matching data on worksheet Frank T Excel Discussion (Misc queries) 1 January 7th 09 05:17 PM
Matching name from one worksheet to another Phrank Excel Worksheet Functions 3 January 4th 08 08:49 AM
Matching data from one worksheet to another. Jeffa Excel Discussion (Misc queries) 3 September 6th 07 09:44 AM
Search & match more than one worksheet and matching cells. Monica Excel Worksheet Functions 0 July 30th 06 10:51 PM


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