Hi,
How to refer Application.WorksheetFunction to the variable which represents column of table?
This macro works perfect:
whilst that does not:
Why?
How to refer Application.WorksheetFunction to the variable which represents column of table?
This macro works perfect:
Code:
Public MyTable as Object
Sub test ()
Set MyTable = ThisWorkbook.Worksheets("Sheet1").ListObjects("MyTable_table")
Msgbox Application.WorksheetFunction.CountIf(MyTable.ListColumns("Column1").DataBodyRange, "John")
End Sub
whilst that does not:
Code:
Public MyTable as Object
Sub test ()
Set MyTable = ThisWorkbook.Worksheets("Sheet1").ListObjects("MyTable_table")
MyColumn = MyTable.ListColumns("Column1").DataBodyRange
Msgbox Application.WorksheetFunction.CountIf(MyColumn, "John")
End Sub
Why?