.Range("A7:F" & x).AutoFilter Field:=6, Criteria1:=(f1lt)
weekcll = Left(Cells(1, weekcol).Address, InStr(2, Cells(1, weekcol).Address, "$"))
sht1.Cells(i, aantcol).Value = Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
If c = 0 Then sht1.Cells(i, aandacol).Value = Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
If c = 1 Then sht1.Cells(i, ihsmacol).Value = Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
weekcll = Left(Cells(1, weekcol + 1).Address, InStr(2, Cells(1, weekcol + 1).Address, "$"))
sht1.Cells(i, omztcol).Value = Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
If c = 0 Then sht1.Cells(i, aandocol).Value = Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
If c = 1 Then sht1.Cells(i, ihsmocol).Value = Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
weekcll = Left(Cells(1, weekcol + 2).Address, InStr(2, Cells(1, weekcol + 2).Address, "$"))
sht1.Cells(i, margcol).Value = Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
sht1.Cells(i, marpcol).Value = sht1.Cells(i, margcol).Value / sht1.Cells(i, omztcol).Value
.Range("A7:F" & x).AutoFilter Field:=6, Criteria1:=(f2lt)
weekcll = Left(Cells(1, weekcol).Address, InStr(2, Cells(1, weekcol).Address, "$"))
If c = 0 Then sht1.Cells(i, aandacol).Value = sht1.Cells(i, aandacol).Value / Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
If c = 1 Then sht1.Cells(i, ihsmacol).Value = sht1.Cells(i, ihsmacol).Value / Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
weekcll = Left(Cells(1, weekcol + 1).Address, InStr(2, Cells(1, weekcol + 1).Address, "$"))
If c = 0 Then sht1.Cells(i, aandocol).Value = sht1.Cells(i, aandocol).Value / Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
If c = 1 Then sht1.Cells(i, ihsmocol).Value = sht1.Cells(i, ihsmocol).Value / Application.Sum(.Range(weekcll & "8:" & weekcll & x).SpecialCells(xlCellTypeVisible))
GoTo nxi
It loops this part 17 times, but in the end, it will loop it about 80 times
Bookmarks