Query multiple sheets and create report

tbutori

New Member
Joined
May 29, 2018
Messages
7
Hello,

I am new to the forum but have used many of the suggestions posted. Thanks to everyone for sharing your knowledge!

I have a workbook with over 100 worksheets. 90 of the worksheets contain equipment check sheets with a section at the bottom of each sheet where follow-up required can be entered. The column positions of each sheet is the same but the row(s) can be anywhere on the sheet. I would like to have all of these follow-ups from each of the 90 sheets transferred to on one report worksheet named "Follow-up".

I don't know how to write VBA code. I tried to use the VLookup function by adding a formula in column A that will return the value of 1 if there is follow-up information in that row. Using the VLookup for every row on every sheet and make it dynamic in case more rows are needed will take forever.
I have watched videos that will transfer the data from multiple sheets to one sheet but the data must be in a table and it must start at the same cell on every sheet. I don't want to change these sheets into tables and the starting cell can be anywhere on the sheet.
I thought Power Query might be the answer but I am new to that as well and have only used it a few times.

I would post an example but I'm not sure how to do that.
Thanks for any help you can provided.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
.
It would be best to post a sample of your workbook for review. You don't have to included all of the data, just a sufficient amount to understand where the values are located and how they might
vary from sheet to sheet.

So long as the value to be located is identical on each sheet - spelled the same - there is either a VBA or Formula method to accomplish your goal.

You'll need to post your sample workbook on a website like DROPBOX or similar. This Forum does not allow for posting of workbooks.
 
Upvote 0
.
It would be best to post a sample of your workbook for review. You don't have to included all of the data, just a sufficient amount to understand where the values are located and how they might
vary from sheet to sheet.

So long as the value to be located is identical on each sheet - spelled the same - there is either a VBA or Formula method to accomplish your goal.

You'll need to post your sample workbook on a website like DROPBOX or similar. This Forum does not allow for posting of workbooks.

Thanks Logit. I have posted the workbook to: https://www.dropbox.com/s/o1lqvd8jm...eance Service Order Master 05-08-18.xlsm?dl=0
There is no sensitive data in the workbook. All of the follow-up information is located between worksheets "a" and "b" in columns B:K with the same headings, just located in different rows.
 
Upvote 0
.
Is it this section on the sheets that you want copied over to the FOLLOW UP sheet ?



A
B
C
D
E
F
G
H
I
J
K
79
Follow-Up Required
80
Location
Notes
Date Diagnosed
VA Status
81
1​
Building 40 AHU-40Recommend program change with freeze stat activation.
2/14/2018​
82
1​
Building 40 AHU-40N duct static transducer located outside rm 215. Adjust drawings.
2/15/2018​
83
1​
Building 40 AHU-40S duct static transducer is located outside rm 229. Adjust drawings.
2/15/2018​
84
1​
Building 40 AHU-40Heater #2 1/3 valve actuator not responding & steam valve leaking. Repair.
2/22/2018​
85
 
Last edited:
Upvote 0
.
This macro, paste into a Routine Module, will copy the "Follow-Up Required" section from each of the sheets containing same. It copies the 6 rows underneath
the title "Follow-Up Required" and pastes the data into the "Follow-Up" sheet.

One problem with your workbook. The LOCATION in the Follow-Up Required table in each of the sheets is dependent upon formulas. In order for that data to be
copied/pasted to the Follow-Up sheet as well, you will need to manually enter the Location data into those cells as the user is entering the other information.
Presently, because of the formulas, the location data is not being transferred as desired.

Code:
Option Explicit


Sub SrchCpyPaste()
    Dim Rws As Long, Rng As Range, ws As Worksheet, sh As Worksheet, c As Range, x As Integer
    Set ws = Worksheets("Follow-up")  'specify sheet name here to paste to
    x = 3   'begins pasting in Sheet 1 on row 2
    Application.ScreenUpdating = 0
    For Each sh In Sheets
        If sh.Name <> ws.Name Then
            With sh
                Rws = .Cells(Rows.Count, "B").End(xlUp).Row 'searches Col D all sheets
                Set Rng = .Range(.Cells(1, "B"), .Cells(Rws, "B"))
                For Each c In Rng.Cells
                    'If c.Value = "Follow-Up Required" Then  'searches for term NO
                    '    c.EntireRow.Copy Destination:=ws.Cells(x, "A")
                    '    x = x + 1
                    'End If
                    
                   If Not IsError(c) Then
                        If c.Value = "Follow-Up Required" Then  'searches for term NO
                            c.Resize(7).EntireRow.Copy Destination:=ws.Cells(x, "A")
                            x = x + 7
                        End If
                    End If
                    
                Next c
            End With
        End If
    Next sh
End Sub
 
Upvote 0
Thanks so much Logit! VBA is amazing.
I did paste the module in and it does work... thanks again.
Just wondering if we can tweak it a little?
I don't need the header to come if for every sheet - one header on the Follow-up sheet will work.
Also, can I make it dynamic so if more rows are added on a sheet, they will transfer as well?

Location Notes Date Diagnosed Status

Then fill in under that one heading at the next available row?
It doesn't look like the code is dependent on my "Check" formula with the value 1 if there is data. Can I remove that formula?
I will have them fill in the location manually so that value will transfer.

Thanks again. I really appreciate your help.
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,947
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top