ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Merging worksheets together (https://www.excelbanter.com/excel-discussion-misc-queries/160182-merging-worksheets-together.html)

sschwickrath

Merging worksheets together
 
I am trying to merge two worksheets together.

my first page has customer names,address,phone number, city, country.
The second page has each person's order they have made.

What i want to do is. On page one, if i double click John Doe, I want all of
the orders he has made to pop up. Instead of opening up two seperate forms
each time!.

I hope this makes sense

joel

Merging worksheets together
 
This is best implimented by adding a button to the toolbar to activate a
regular macro. Select a cells on sheet one and run macro. the macro
performs a copy of all rows that have the customer name in Column A. After
the macro is run all you have to do is do a paste where you want the rows the
data to be placed.

Sub findcustomer()

CustomerName = ActiveCell
First = True
With Sheets("Sheet2")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
For RowCount = 1 To LastRow

If .Range("A" & RowCount) = CustomerName Then
If First = True Then
Set SelectRows = .Rows(RowCount)
First = False
Else
Set SelectRows = _
Application.Union(SelectRows, _
.Rows(RowCount))
End If
End If
Next RowCount
End With

SelectRows.Copy

End Sub

"sschwickrath" wrote:

I am trying to merge two worksheets together.

my first page has customer names,address,phone number, city, country.
The second page has each person's order they have made.

What i want to do is. On page one, if i double click John Doe, I want all of
the orders he has made to pop up. Instead of opening up two seperate forms
each time!.

I hope this makes sense



All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com