VBA Run-time Error '424' Object required RRS feed

  • Question

  • I am trying to pass a range object from one macro to another and am getting the following errorL  run-tim error '42': Object required

    Below is the code i am testing.  The error occurs on the functiion call to "PassRange(myRange)"

    Sub setRange()
        Dim myRange As Range
        Set myRange = Worksheets("Mysheet").Range("A1")
        PassRange (myRange)

    End Sub

    Sub PassRange(currentRange As Range)
    End Sub

    Thanks for the help.

    Tuesday, February 12, 2013 5:56 PM

All replies

  • Change

        PassRange (myRange)


        PassRange myRange

    or to

        Call PassRange(myRange)

    Regards, Hans Vogelaar

    Tuesday, February 12, 2013 9:57 PM