Forum Discussion

Re: FILTER function across multiple sheets, display in separate sheet

jenjers 

Sub CurrentWeekData()

    Dim WBK As Workbook
    Dim WKS As Worksheet
    Dim i As Long
    Dim wn As Long
    Dim j As Long
    Dim k As Long
    Dim m As Integer
    
    Worksheets("planner sheet").Range("A2:Z1048576").Clear
    
    k = 2
    
    wn = Format(Date, "ww")
        
    For Each WKS In ThisWorkbook.Worksheets
        If WKS.Name <> "planner sheet" Then
        
        i = WKS.Range("A" & Rows.Count).End(xlUp).Row
        
        For j = 2 To i
        If WKS.Cells(j, 1).Value = wn Then
        
        For m = 1 To 26
        Worksheets("planner sheet").Cells(k, m).Value = WKS.Cells(j, m).Value
        
        Next m
                
        k = k + 1
        Else
        End If
        Next j
                
        End If
    Next WKS

End Sub

Maybe with these lines of code. In the attached file you can click the button in cell AB2 to run the macro.

No RepliesBe the first to reply

Resources