How to reference an active table in a FormulaR1C1

mdo8105

Board Regular
Joined
Nov 13, 2015
Messages
83
I have a workbook that has multiple tables on each worksheet. Here is the formula that I have:
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.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,215,047
Messages
6,122,858
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top