Hi,
I need your help with converting my formula into VBA Code.Please can you help me with this code, it spring a runtime error on line 2. Why?
Excel:Formula =IF(COUNTIFS(F3:F10,"NONE_TP")=0,"",(COUNTIFS(F3:F10,"NONE_TP")))
I need your help with converting my formula into VBA Code.Please can you help me with this code, it spring a runtime error on line 2. Why?
Excel:Formula =IF(COUNTIFS(F3:F10,"NONE_TP")=0,"",(COUNTIFS(F3:F10,"NONE_TP")))
Rich (BB code):
Sub TestPhase2
Dim ws As Worksheets<o:p></o:p>
Dim lr As Long<o:p></o:p>
Dim var1 As String<o:p></o:p>
<o:p> </o:p>
'----------------------------<o:p></o:p>
'Variable<o:p></o:p>
'----------------------------<o:p></o:p>
Sheets("DetailMapping").Select<o:p></o:p>
lr = Sheets("DetailMapping").Cells(Rows.Count,6).END(xlDown).Rows<o:p></o:p>
var1 = Range("F1").Value<o:p></o:p>
<o:p> </o:p>
'----------------------------<o:p></o:p>
'Actual Condition<o:p></o:p>
'----------------------------<o:p></o:p>
If var1 = 0 Then<o:p></o:p>
<o:p></o:p>
var1 =Application.WorksheetFunction.CountIfs(Range("F3:F" & lr),"CUST2-NONE")<o:p></o:p>
<o:p></o:p>
Else (I'm thinking this is where I'm going wrong)<o:p></o:p>
<o:p></o:p>
var1 =Application.WorksheetFunction.CountIfs(Range("F3:F" & lr), "")<o:p></o:p>
<o:p></o:p>
End If<o:p></o:p>
End Sub