VBABEGINER
Well-known Member
- Joined
- Jun 15, 2011
- Messages
- 1,284
- Office Version
- 365
- Platform
- Windows
Yep, another new query.
I require to check the synta of which function is right?
Function 1 -
Function 2- ...This is only for one cell i.e.- D9
I require to check the synta of which function is right?
Function 1 -
Public Function showcount()
Range("D7") = Application.WorksheetFunction.CountIf(Range("C15:C"), 1)
Range("D8") = Application.WorksheetFunction.CountIf(Range("C15:C"), 2)
Range("D9") = Application.WorksheetFunction.CountIf(Range("C15:C"), 3)
Range("D10") = Application.WorksheetFunction.CountIf(Range("C15:C"), 4)
Range("D11") = Application.WorksheetFunction.CountIf(Range("C15:C"), 5)
Range("D12") = Application.WorksheetFunction.CountIf(Range("C15:C"), 6)
Range("D13") = Application.WorksheetFunction.CountIf(Range("C15:C"), 7)
End Function
Function 2- ...This is only for one cell i.e.- D9
Public Function test()
Dim ax As Long
ax = Range("C" & Rows.Count).End(xlUp).Row
If ax < 9 Then
ax = 9
Range("D9") = Application.WorksheetFunction.CountIf(Range("D9:D" & ax), "3")
End If
End Function