Hello all.
Can anyone tell me why this works
[vba]Worksheets(sThisSample).Activate
Application.Range("A1").Activate
'Count returns long data type, cast to integer.
iAnswer = CInt(WorksheetFunction.Count(Worksheets(sThisSample).Range("A2:A8000")))
[/vba]
yet this doesn't
[vba]Worksheets(sThisSample).Activate
Application.Range("A1").Activate
'Count returns long data type, cast to integer.
iAnswer = CInt(WorksheetFunction.Count("A2:A8000"))
[/vba]
I assume since worksheet sThisSample is in scope, the count function will use the range A2:A8000 on that worksheet. It works fine in an earlier section of code where the starting sheet is active.