Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Combine Worsheets (Excel 03)

Hi,

How can I combine (2) worksheets that have different data being pulled from
and ODBC into one Worksheet based on an Order Number?

Sheet 1
A1 B1 C1 D1
Order Nbr Ship Date Customer Description

Sheet 2
A1 B1
Order Nbr Contract Price

This is to be copied into a 3rd sheet combing all Data
A1 B1 C1 D1 E1
Order Nbr Ship Date Customer Description Contract Price

Any help would be appreciated.

Thank you,
Havenstar
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Combine Worsheets (Excel 03)

Sounds like you will want to use the VLOOKUP command. Something like
=VLOOKUP(A2,Sheet2!A2:B100,2,FALSE)
placed in E2 of sheet 3 would help you match up your data.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Havenstar" wrote:

Hi,

How can I combine (2) worksheets that have different data being pulled from
and ODBC into one Worksheet based on an Order Number?

Sheet 1
A1 B1 C1 D1
Order Nbr Ship Date Customer Description

Sheet 2
A1 B1
Order Nbr Contract Price

This is to be copied into a 3rd sheet combing all Data
A1 B1 C1 D1 E1
Order Nbr Ship Date Customer Description Contract Price

Any help would be appreciated.

Thank you,
Havenstar

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Combine Worsheets (Excel 03)

Try this code

Sub CombineSheets()

'clear sheet 3
Sheets("Sheet3").Cells.ClearContents

'Copy sheet 1 to Sheet 3
Sheets("Sheet1").Cells.Copy _
Destination:=Sheets("Sheet3").Cells

'Add Missing Header to shbeet 3
Sheets("Sheet3").Range("E1") = "Contract Price"
LastRow = Sheets("Sheet3").Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1

'merge Sheet 2 in to sheet 3
With Sheets("Sheet2")
RowCount = 2
Do While .Range("A" & RowCount) < ""
OrderNbr = .Range("A" & RowCount)
Price = .Range("B" & RowCount)
With Sheets("Sheet3")
Set c = .Columns("A").Find(what:=OrderNbr, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
'Order Number not found on sheet 2, add to new row
.Range("A" & NewRow) = OrderNbr
.Range("E" & NewRow) = Price
NewRow = NewRow + 1
Else
.Range("E" & c.Row) = Price
End If
End With

RowCount = RowCount + 1
Loop

End With

End Sub


"Havenstar" wrote:

Hi,

How can I combine (2) worksheets that have different data being pulled from
and ODBC into one Worksheet based on an Order Number?

Sheet 1
A1 B1 C1 D1
Order Nbr Ship Date Customer Description

Sheet 2
A1 B1
Order Nbr Contract Price

This is to be copied into a 3rd sheet combing all Data
A1 B1 C1 D1 E1
Order Nbr Ship Date Customer Description Contract Price

Any help would be appreciated.

Thank you,
Havenstar

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
How do I combine many worsheets into one worksheet?? Teric506 Excel Discussion (Misc queries) 6 November 21st 07 05:00 PM
Is it possible to combine two worsheets into one Pivot Table? Diane13 Excel Worksheet Functions 2 August 3rd 06 07:16 PM
Link worsheets in Excel Djasabe Excel Worksheet Functions 2 June 2nd 06 08:15 PM
How to avoid duplicates across multiple worsheets in excel? Lisa J Excel Discussion (Misc queries) 1 May 22nd 06 09:01 PM
Linking 2 Worsheets Mike_C Links and Linking in Excel 3 August 10th 05 11:14 PM


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