I am trying to set a value for CurrentClient Variable i have defined below and then using it to count how many times it Occurs in a range. I am not sure what am i doing wrong here . It is giving me error: "runtime error 9 subscript out of range" on step where it is assigning the value from Sheet 2 cell A2 to Currentclient.
Please help.
Sub GetValue()
Dim ClientCnt As Integer
Dim CurrentClient As String
CurrentClient = Sheets("Sheet 2").Range("A2").Text
ClientCnt = Application.WorksheetFunction.CountIf(Range("A:A"), CurrentClient)
End Sub
.Texttry.Value