How to make column AD ,W ,J,,K,L dynamic in vba the data always starts at row 2.
Actually lock at row 915 , but if data goes to row 1500 or 20000 or 50
how to adjust code below
Sub reporttwistsheetAV()
With Worksheets("Report")
With .Range("D2:G" & .Range("C" & ROWS.Count).End(xlUp).Row)
.Formula = "=SUMPRODUCT(CustomerA!W$2:W$915,--(CustomerA!$J$2:$J$915=Report!$A2),--(CustomerA!$K$2:$K$915=Report!$B2),--(CustomerA!$L$2:$L$915=Report!$C2))"
'.Value = .Value
End With
With .Range("H2:H" & .Range("C" & ROWS.Count).End(xlUp).Row)
.Formula = "=SUMPRODUCT(CustomerA!AD$2:AD$915,--(CustomerA!$J$2:$J$915=Report!$A2),--(CustomerA!$K$2:$K$915=Report!$B2),--(CustomerA!$L$2:$L$915=Report!$C2))"
'.Value = .Value
End With
End With
End Sub
Bookmarks