I'm trying to have a sorting macro that finds the range size by using the counta function. However when I run this code I get a value for counta of 1 but a value of 4 when I use it directly within excel.
Sub Macro1()
Dim counterx As Integer
Dim countery As Integer
Sheets("POC Information").Select
counterx = WorksheetFunction.CountA("i3:xfd3")
countery = WorksheetFunction.CountA("C:C") - 1
With ActiveWorkbook.Worksheets("POC Information").Sort
.SetRange Range("B3:L" & countery)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Can anyone tell me what's going on?
Sub Macro1()
Dim counterx As Integer
Dim countery As Integer
Sheets("POC Information").Select
counterx = WorksheetFunction.CountA("i3:xfd3")
countery = WorksheetFunction.CountA("C:C") - 1
With ActiveWorkbook.Worksheets("POC Information").Sort
.SetRange Range("B3:L" & countery)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Can anyone tell me what's going on?