+ Reply to Thread
Results 1 to 4 of 4

R/T error - 424 - Why?

Hybrid View

  1. #1
    Jim May
    Guest

    R/T error - 424 - Why?

    My code down to the problem...

    Sub Foo()
    Dim lrow As Long
    Dim numhpb As Long
    Dim lrprint As Long
    Dim LPage As Long
    Dim i As Integer
    Dim STRng As Range
    Application.EnableEvents = False
    Set STRng = Application.InputBox("Highlight the Range of Amts to be
    Subtotaled", Type:=8) <<<< error here !! (this statement is on one line)

  2. #2
    K Dales
    Guest

    RE: R/T error - 424 - Why?

    The SET statement (SET STRng = ...) is to set an object variable equal to
    another object of the same type (or to NOTHING). Just use plain "=" here.
    --
    - K Dales


    "Jim May" wrote:

    > My code down to the problem...
    >
    > Sub Foo()
    > Dim lrow As Long
    > Dim numhpb As Long
    > Dim lrprint As Long
    > Dim LPage As Long
    > Dim i As Integer
    > Dim STRng As Range
    > Application.EnableEvents = False
    > Set STRng = Application.InputBox("Highlight the Range of Amts to be
    > Subtotaled", Type:=8) <<<< error here !! (this statement is on one line)


  3. #3
    K Dales
    Guest

    RE: R/T error - 424 - Why?

    Should have also looked at the context of what you are doing, sorry!
    Actually your code works fine on my machine as written. However, the 424
    error implies that it does not recognize the either STRng or the InputBox
    result as an object. I am also baffled.

    --
    - K Dales


    "K Dales" wrote:

    > The SET statement (SET STRng = ...) is to set an object variable equal to
    > another object of the same type (or to NOTHING). Just use plain "=" here.
    > --
    > - K Dales
    >
    >
    > "Jim May" wrote:
    >
    > > My code down to the problem...
    > >
    > > Sub Foo()
    > > Dim lrow As Long
    > > Dim numhpb As Long
    > > Dim lrprint As Long
    > > Dim LPage As Long
    > > Dim i As Integer
    > > Dim STRng As Range
    > > Application.EnableEvents = False
    > > Set STRng = Application.InputBox("Highlight the Range of Amts to be
    > > Subtotaled", Type:=8) <<<< error here !! (this statement is on one line)


  4. #4
    Dave Peterson
    Guest

    Re: R/T error - 424 - Why?

    If the user hits cancel, you'll get that error.

    You may want to try:

    set strng = nothing
    on error resume next
    set strng = application.inputbox(...., type:=8)
    on error goto 0

    if strng is nothing then
    'user hit cancel
    else
    'do the work
    end if

    ==========
    And something from Ron de Bruin and Jan Karel Pieterse that could be your
    problem:
    http://www.jkp-ads.com/Articles/SelectARange.asp

    Jim May wrote:
    >
    > My code down to the problem...
    >
    > Sub Foo()
    > Dim lrow As Long
    > Dim numhpb As Long
    > Dim lrprint As Long
    > Dim LPage As Long
    > Dim i As Integer
    > Dim STRng As Range
    > Application.EnableEvents = False
    > Set STRng = Application.InputBox("Highlight the Range of Amts to be
    > Subtotaled", Type:=8) <<<< error here !! (this statement is on one line)


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1