I'm trying to refernce the [completed] column in a table. The table is a variable based on a value in a vlookup. When I hardcode the table name into the range reference, the code works, however when I enter the variable I get a meothd rnage of object failed. I shouldnt have to use the quotes around tn but vba doesnt like it when I take those away. Thoughts??
Set rng = Application.Range("tn[completed]")----> this doesnt work
'Set rng = Application.Range("table1[completed]") ----> this works
For Each c In rng.Cells
ActiveSheet.CheckBoxes.Add(c.Left, c.Top, c.Width, c.Height).Select
With Selection
.LinkedCell = c.Address
.Characters.Text = ""
.Name = c.Address
End With
c.Select
With Selection
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=" & c.Address & "=TRUE"
.NumberFormat = ";;;"
End With
Next
Set rng = Application.Range("tn[completed]")----> this doesnt work
'Set rng = Application.Range("table1[completed]") ----> this works
For Each c In rng.Cells
ActiveSheet.CheckBoxes.Add(c.Left, c.Top, c.Width, c.Height).Select
With Selection
.LinkedCell = c.Address
.Characters.Text = ""
.Name = c.Address
End With
c.Select
With Selection
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=" & c.Address & "=TRUE"
.NumberFormat = ";;;"
End With
Next