Thread: COUNTIF in VBA
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Wim VL Wim VL is offline
external usenet poster
 
Posts: 1
Default COUNTIF in VBA

Why does this (part of a) macro not work? Who can help me to find a solution?

Dim MyData As Range
Dim MyResult As Range
Set MyData = Range("D4:D14")
Set MyResult = Range("D16")
MyResult.Select
Selection.Formula = "=COUNTIF(MyData,""*less*"")"
'This one does not work.It doesn't recognize "MyData" as a range.
"MyData" appears as 'text' in the Excelsheet.