Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
There should be a mail merge feature between excel and access. | Excel Discussion (Misc queries) | |||
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER | New Users to Excel | |||
Find differences between two Excel workbooks or worksheets | Excel Discussion (Misc queries) | |||
Merge using Excel 2002 and Hummingbird Docs Open 3.9.0 Build 199 | Excel Discussion (Misc queries) | |||
Trying to merge two excel worksheets | Excel Discussion (Misc queries) |