LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
JB
 
Posts: n/a
Default Merge 2 Excel Worksheets


http://cjoint.com/?fhiNdcKk3i

Sub Merge()
If Sheets("PriceList").[A1].End(xlDown) < "zzz" Then
Sheets("PriceList").[A1].End(xlDown).Offset(1, 0) = "zzz"
If Sheets("InfoList").[A1].End(xlDown) < "zzz" Then
Sheets("InfoList").[A1].End(xlDown).Offset(1, 0) = "zzz"
i = 2: j = 2: k = 2
Do While Not (Sheets("PriceList").Cells(i, 1) = "zzz" And
Sheets("InfoList").Cells(j, 1) = "zzz")
If Sheets("PriceList").Cells(i, 1) < Sheets("InfoList").Cells(j, 1)
Then
Sheets("result").Cells(k, 1) = Sheets("priceList").Cells(i, 1)
Sheets("result").Cells(k, 2) = Sheets("priceList").Cells(i, 2)
Sheets("result").Cells(k, 3) = Sheets("priceList").Cells(i, 3)
i = i + 1: k = k + 1
Else
If Sheets("PriceList").Cells(i, 1) Sheets("InfoList").Cells(j,
1) Then
Sheets("result").Cells(k, 1) = Sheets("InfoList").Cells(j, 1)
Sheets("result").Cells(k, 4) = Sheets("InfoList").Cells(j, 3)
Sheets("result").Cells(k, 5) = Sheets("InfoList").Cells(j, 4)
Sheets("result").Cells(k, 6) = Sheets("InfoList").Cells(j, 5)
Sheets("result").Cells(k, 7) = Sheets("InfoList").Cells(j, 6)
j = j + 1: k = k + 1
Else
Sheets("Result").Cells(k, 1) = Sheets("InfoList").Cells(j, 1)
Sheets("Result").Cells(k, 2) = Sheets("InfoList").Cells(j, 2)
Sheets("result").Cells(k, 3) = Sheets("priceList").Cells(i, 3)
Sheets("result").Cells(k, 4) = Sheets("InfoList").Cells(j, 3)
Sheets("result").Cells(k, 5) = Sheets("InfoList").Cells(j, 4)
Sheets("result").Cells(k, 6) = Sheets("InfoList").Cells(j, 5)
Sheets("result").Cells(k, 7) = Sheets("InfoList").Cells(j, 6)
i = i + 1: j = j + 1: k = k + 1
End If
End If
Loop
End Sub

Cordialy JB



 
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
There should be a mail merge feature between excel and access. Vira-SJH Excel Discussion (Misc queries) 0 January 3rd 06 06:20 PM
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER MEGTOM New Users to Excel 5 October 27th 05 03:06 AM
Find differences between two Excel workbooks or worksheets savage_planet Excel Discussion (Misc queries) 0 September 19th 05 09:27 PM
Merge using Excel 2002 and Hummingbird Docs Open 3.9.0 Build 199 a_ryan1972 Excel Discussion (Misc queries) 0 April 15th 05 01:45 PM
Trying to merge two excel worksheets Matt Carter Excel Discussion (Misc queries) 0 April 8th 05 03:11 PM


All times are GMT +1. The time now is 10:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"