Look up tables across workbook
Closed
MACrucible
Posts
1
Registration date
Saturday May 5, 2018
Status
Member
Last seen
May 5, 2018
-
May 5, 2018 at 11:54 AM
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - May 7, 2018 at 06:38 AM
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - May 7, 2018 at 06:38 AM
Related:
- Look up tables across workbook
- Oracle show tables - Guide
- Vba copy data from one workbook to another - Guide
- Vb net add sheet to excel workbook - Guide
- Run macro when workbook opens - Guide
- Transfer data from one excel workbook to another automatically - Guide
1 response
vcoolio
Posts
1411
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
September 6, 2024
262
May 7, 2018 at 06:38 AM
May 7, 2018 at 06:38 AM
Hello MACrucible,
See if the following code does the task for you:-
I've made the following assumptions:-
- Sheet1 (the destination sheet) has a search box in cell A1.
- Sheet 1 headings are in row 2.
- Source sheet headings are in row 1 with data commencing in row 2.
- Source sheet dates are in Column A.
The code basically filters Column A of each worksheet for the date placed in cell A1 of the main (destination) sheet and then transfers the relevant row of data to the destination sheet.
I've attached a little sample for you to play with at the following link:-
http://ge.tt/6dRfyhp2
Place a date (based on the ones you see in the two source sheets) in cell A1 of the main sheet then click on "GO" to see the code at work.
I hope that this helps.
Cheerio,
vcoolio.
See if the following code does the task for you:-
Sub FindData()
Dim ws As Worksheet
Dim dSrch As String
dSrch = Sheet1.[A1].Value
If dSrch = "" Then Exit Sub
Application.ScreenUpdating = False
For Each ws In Worksheets
If ws.Name <> "Sheet1" Then
With ws.[A1].CurrentRegion
.AutoFilter 1, dSrch
.Offset(1).EntireRow.Copy
Sheet1.Range("A" & Rows.Count).End(3)(2).PasteSpecial xlValues
.AutoFilter
End With
End If
Next ws
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
I've made the following assumptions:-
- Sheet1 (the destination sheet) has a search box in cell A1.
- Sheet 1 headings are in row 2.
- Source sheet headings are in row 1 with data commencing in row 2.
- Source sheet dates are in Column A.
The code basically filters Column A of each worksheet for the date placed in cell A1 of the main (destination) sheet and then transfers the relevant row of data to the destination sheet.
I've attached a little sample for you to play with at the following link:-
http://ge.tt/6dRfyhp2
Place a date (based on the ones you see in the two source sheets) in cell A1 of the main sheet then click on "GO" to see the code at work.
I hope that this helps.
Cheerio,
vcoolio.