kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
Hi, I have these lines that I need to make shorter with a for loop or anything cooler. I have been on the offset thing for a while now, can’t seem to figure it out.
I want someone pull me out. Thanks
I want someone pull me out. Thanks
Code:
Sub getCount()
Dim i&, j&
i = Me.cbByName.ListIndex
j = i + 3
With Sheet11
[B2] = Application.CountIf(.Range("I" & j & ":" & "M" & j), "/")
[B3] = Application.CountIf(.Range("N" & j & ":" & "R" & j), "/")
[B4] = Application.CountIf(.Range("S" & j & ":" & "W" & j), "/")
[B5] = Application.CountIf(.Range("X" & j & ":" & "AB" & j), "/")
[B6] = Application.CountIf(.Range("AC" & j & ":" & "AG" & j), "/")
[B7] = Application.CountIf(.Range("AH" & j & ":" & "AL" & j), "/")
[B8] = Application.CountIf(.Range("AM" & j & ":" & "AQ" & j), "/")
[B9] = Application.CountIf(.Range("AR" & j & ":" & "AV" & j), "/")
[B10] = Application.CountIf(.Range("AW" & j & ":" & "BA" & j), "/")
[B11] = Application.CountIf(.Range("BB" & j & ":" & "BF" & j), "/")
[B12] = Application.CountIf(.Range("BG" & j & ":" & "BK" & j), "/")
[B13] = Application.CountIf(.Range("BL" & j & ":" & "BP" & j), "/")
End With
End Sub