I have a workbook that has multiple tables on each worksheet. Here is the formula that I have:
I am wanting to replace Table146 in the formula with "myTable", but I cannot figure out how with out causing an error.
Code:
Sub Test()
Const WHAT_TO_FIND As String = "Application"
Dim ws As Excel.Worksheet
Dim FoundCell As Excel.Range
Dim myTable As ListObject
Set ws = ActiveSheet
Set FoundCell = ws.Range("B:B").Find(what:=WHAT_TO_FIND, lookat:=xlWhole)
Set myTable = ActiveSheet.ListObjects(1)
V1 = FoundCell.Offset(-3).Row
V1b = FoundCell.Offset(1).Row
ws.Range("B" & V1).Select
ActiveCell.FormulaR1C1 = "=IF(COUNTIF(Table146[Pass/" & Chr(10) & "Fail],""Pass"")= COUNTA(Table146[Pass/" & Chr(10) & "Fail]),""Passed"",IF(COUNTIF(Table146[Pass/" & Chr(10) & "Fail],""Fail"")>0,""Failed"",IF(COUNTIF(Table146[Pass/" & Chr(10) & "Fail],""Untested"")= COUNTA(Table146[Pass/" & Chr(10) & "Fail]),""Untested"",IF(COUNTIF(Table146[Pass/" & Chr(10) & "Fail],""Pass"")< COUNTA(Table146[Pass/" & Chr(10) & "Fail]),""Inprogress""))))"
End Sub
I am wanting to replace Table146 in the formula with "myTable", but I cannot figure out how with out causing an error.