Advertisement
YasserKhalil2019

T3932_Loop Through Range Columns Using COUNTIFS

Sep 18th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. https://excel-egy.com/forum/t3932
  2. ---------------------------------
  3.  
  4. Sub Loop_Through_Range_Columns_Using_COUNTIFS()
  5. Dim rng As Range, c As Integer, n As Integer
  6.  
  7. Application.ScreenUpdating = False
  8. Set rng = Range("I1:V3")
  9.  
  10. For c = 1 To rng.Columns.Count Step 5
  11. For n = 1 To 4
  12. Cells(3, c + n + 7).Formula = "=COUNTIFS($F:$F," & Cells(2, c + n + 7).Address & ",$E:$E," & Cells(1, c + 8).Address & ")"
  13. Cells(3, c + n + 7).Value = Cells(3, c + n + 7).Value
  14. Next n
  15. Next c
  16. Application.ScreenUpdating = True
  17. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement