Marc Poirier
Marc Poirier

Reputation: 37

"Method range of object global failed" Calling for a named range in VBA

I need some help fixing this error a ran into with a named range. So I'm getting the "Method range of object global failed" on Range("Frost_T"). I defined the Range Frost_T in the name manger but it's not exactly a range it's basically just a formula taking an input from a cell to calculate an output and the output itself is not in a define cell it's just under Frost_T and then I callout that name in other formulas within the workbook. That part works fine it's when I try to use it in VBA for macros It's not working. I need help to learn how to callout these kind of named range that aren't really in a range of cells but just kept under it's name. I tied explaining it the best way I can but if you need more details let me know. See code bellow.

Thanks in advance for the help!

Sub OA_T_Reset()

  If Range("CB_CL_Values").Cells(6) = 1 Then

    If Range("Inputs_OA").Cells(3) < Range("Frost_T") = True Then
    Range("Inputs_OA").Cells(3).Value = Range("Frost_T")

    Else

    End If

  Else

  End If


End Sub

Upvotes: 1

Views: 407

Answers (1)

Dmitry Pavliv
Dmitry Pavliv

Reputation: 35853

Try to change Range("Frost_T") to Evaluate("Frost_T") as follows:

Sub OA_T_Reset()

    If Range("CB_CL_Values").Cells(6) = 1 Then
        If Range("Inputs_OA").Cells(3) < Evaluate("Frost_T") Then
            Range("Inputs_OA").Cells(3).Value = Evaluate("Frost_T")
        Else

        End If
    Else

    End If

End Sub

Upvotes: 2

Related Questions