Anthropologista
New Member
- Joined
- Nov 5, 2017
- Messages
- 12
Hello all,
I am writing a simple macro to count the number of categories in a dynamic range by:
I can’t get the following code to work. Any help is appreciated!
I am writing a simple macro to count the number of categories in a dynamic range by:
- Offsetting the bottom of the range (“SectionInfant”) by -1
- CountA the resulting range (B4 to Target)
- Paste the resulting number in F1
I can’t get the following code to work. Any help is appreciated!
Code:
Sub Auto_Open()
Dim CurrentList As Integer
Dim Target As Range
Set Target = Range("SectionInfant").Offset(-1, 0)
CurrentList = Application.WorksheetFunction.CountA(Sheets("TOL Categories").Range(Range("B4", Target)))
Sheets("TOL Categories").Range("F1").Value = CurrentList
End Sub