(Solved) – VLookup and Countif for Similar Partial Sheet Name


Assuming I have a main sheet named Main Sheet, it also has column names which are Big, Medium, Small respectively. Now, I have already written a macro to auto generate sheets which its names are going to be Data 001, Data 002, etc. Within these sheets that are generated, it also contains the Big, Medium, Small column. What I wish to do now is to do a vlookup and countif to all sheets which its name contains the word Data. Any ideas would be helpful, thanks in advance! The code below are what I’ve came up with so far:

Private Sub WarehouseSheetMacro()
Dim warehousews As Worksheet
    For Each warehousews In ActiveWorkbook.Worksheets
        If InStr(1, warehousews.Name, "Warehouse") > 0 Then

        'Not sure what to fill in for the vlookup part

        GoTo ReStart:
        End If
    Next waerehousews
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *