how to merge two sheet in to master sheet?

kim gutierrez

New Member
Joined
Dec 4, 2014
Messages
1
i am working on this two sheets, the HR sheet and LOTUS NOTES sheet both are list of employees, in the HR sheet the names are complete (first name,last name, middle name) in one cell in lotus notes sheet the name are just lastname and firstname in a cell i need a master list where i will combine the list of employee in HR sheet and in LOTUS NOTES sheet but not doubled the entry name in master list (e.g.

HR Sheet
[TABLE="class: outer_border, width: 500"]
<TBODY>[TR]
[TD]emp no.
[/TD]
[TD]emp name
[/TD]
[TD]email
[/TD]
[TD]status
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]glazyrene kim E. Gutierrez
[/TD]
[TD]gkeg@gmail.com
[/TD]
[TD]Active
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Judith O. Espinosa
[/TD]
[TD]JOE@yahoo.com
[/TD]
[TD]Retired
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Joan E. Ignacio
[/TD]
[TD]JEI@mail.com
[/TD]
[TD]Active
[/TD]
[/TR]
</TBODY>[/TABLE]

Lotus Notes sheet
[TABLE="class: outer_border, width: 500"]
<TBODY>[TR]
[TD]emp no.
[/TD]
[TD]emp name
[/TD]
[TD]age
[/TD]
[TD]department
[/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD]kim Gutierrez
[/TD]
[TD]25
[/TD]
[TD]Hr DEpartment
[/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]Jocelyn Ocampo
[/TD]
[TD]30
[/TD]
[TD]Accounting Dep
[/TD]
[/TR]
[TR]
[TD]10
[/TD]
[TD]Judith Espinosa
[/TD]
[TD]39
[/TD]
[TD]It DEP
[/TD]
[/TR]
</TBODY>[/TABLE]

Master List
[TABLE="class: outer_border, width: 500"]
<TBODY>[TR]
[TD]emp no.
[/TD]
[TD]emp name
[/TD]
[TD]age
[/TD]
[TD]department
[/TD]
[TD]Email
[/TD]
[TD]status
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]glazyrene kim E. Gutierrez
[/TD]
[TD]25
[/TD]
[TD]Hr DEpartment
[/TD]
[TD]gkeg@gmail.com
[/TD]
[TD]active
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Judith O. Espinosa
[/TD]
[TD]39
[/TD]
[TD]It DEP
[/TD]
[TD]JOE@yahoo.com
[/TD]
[TD]retired
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Joan E. Ignacio
[/TD]
[TD]32
[/TD]
[TD]Accounting Dep
[/TD]
[TD]JEI@mail.com
[/TD]
[TD]active
[/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]Jocelyn Ocampo
[/TD]
[TD]30
[/TD]
[TD]Accounting Dep
[/TD]
[TD]JO@BSP.com
[/TD]
[TD]active
[/TD]
[/TR]
</TBODY>[/TABLE]

i have this code where it creates master list in a workbook if it doesnt have and delete a master list if it has already so that the master list is updated. it does copy the data in both sheet like this


sheet1
[TABLE="class: outer_border, width: 500"]
<TBODY>[TR]
[TD]emp no
[/TD]
[TD]emp name
[/TD]
[TD]status
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]glazyrene kim E. Gutierrez
[/TD]
[TD]active
[/TD]
[/TR]
</TBODY>[/TABLE]


sheet 2

[TABLE="class: outer_border, width: 500"]
<TBODY>[TR]
[TD]emp no
[/TD]
[TD]emp name
[/TD]
[TD]status
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]glazyrene kim Gutierrez
[/TD]
[TD]active
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Judith O. Espinosa
[/TD]
[TD]retired
[/TD]
[/TR]
</TBODY>[/TABLE]

master list [TABLE="class: outer_border, width: 500"]
<TBODY>[TR]
[TD]emp no
[/TD]
[TD]emp name
[/TD]
[TD]status
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]glazyrene kim E. Gutierrez
[/TD]
[TD]active
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]glazyrene kim Gutierrez
[/TD]
[TD]active
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Judith O. Espinosa
[/TD]
[TD]retired
[/TD]
[/TR]
</TBODY>[/TABLE]

code:

Sub CopyDataWithoutHeaders()
Dim sh As Worksheet
Dim DestSh As Worksheet
Dim Last As Long
Dim shLast As Long
Dim CopyRng As Range
Dim StartRow As Long
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'Delete the sheet "MASTER LIST" if it exist
Application.DisplayAlerts = False
On Error Resume Next
ActiveWorkbook.Worksheets("MASTER LIST").Delete
On Error GoTo 0
Application.DisplayAlerts = True

'Add a worksheet with the name "MASTER LIST"
Set DestSh = ActiveWorkbook.Worksheets.Add
DestSh.Name = "MASTER FILE"
'Fill in the start row
StartRow = 2
'loop through all worksheets and copy the data to the DestSh
For Each sh In ActiveWorkbook.Worksheets

'Loop through all worksheets except the RDBMerge worksheet and the
'Information worksheet, you can ad more sheets to the array if you want.
If IsError(Application.Match(sh.Name, _
Array(DestSh.Name, "Information"), 0)) Then
'Find the last row with data on the DestSh and sh
Last = LastRow(DestSh)
shLast = LastRow(sh)
'If sh is not empty and if the last row >= StartRow copy the CopyRng
If shLast > 0 And shLast >= StartRow Then
'Set the range that you want to copy
Set CopyRng = sh.Range(sh.Rows(StartRow), sh.Rows(shLast))
'Test if there enough rows in the DestSh to copy all the data
If Last + CopyRng.Rows.Count > DestSh.Rows.Count Then
MsgBox "There are not enough rows in the Destsh"
GoTo ExitTheSub
End If
'This example copies values/formats, if you only want to copy the
'values or want to copy everything look below example 1 on this page
CopyRng.Copy
With DestSh.Cells(Last + 1, "A")
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
Application.CutCopyMode = False
End With
End If
End If
Next
ExitTheSub:
Application.Goto DestSh.Cells(1)
'AutoFit the column width in the DestSh sheet
DestSh.Columns.AutoFit
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub


" i appreciate any help thanks a lot and God bless"
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,223,758
Messages
6,174,334
Members
452,555
Latest member
colc007

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top