Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: VBA, InputBox, Run-time error '424': Object required
Thanks Thanks: 0 Likes Likes: 0

  1. #11
    MrExcel MVP mikerickson's Avatar
    Join Date
    Jan 2007
    Location
    Davis CA
    Posts
    22,590
    Post Thanks / Like
    Mentioned
    20 Post(s)
    Tagged
    15 Thread(s)

    Default Re: VBA, InputBox, Run-time error '424': Object required

    The problem with using InputBox like this is that the keyword Set isn't used.
    Therefore Excel is using the default .Value property and rng will never be a range object.
    Code:
    Dim rng As Variant
    rng = Application.InputBox("select a range", Type:=8)
    
    MsgBox TypeName(rng)
    I'm surprised that the code in post #7 isn't erring when it gets to the line
    sHeading = rng.Value

  2. #12
    New Member
    Join Date
    Aug 2013
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA, InputBox, Run-time error '424': Object required

    I am getting Error 424 when I run this code. It is getting hung up on the Set statements. Here is the initial part of the VBA code:

    Sub Scheme()
    Dim I As Characters, CDL As Characters, SP As Characters, Flag As Characters, Flag2 As Characters
    Dim AZ As Characters, FS As Integer, FA As Integer, SA As Integer, AR As Integer, SR As Integer
    Dim AC As Integer, AT As Integer, AE As Integer, SC As Integer, ST As Integer
    Dim Z As Integer, A As Integer, B As Integer, NN As Integer, NFS As Integer, L As Variant
    Dim NFA As Integer, NAE As Integer, NSA As Integer, NAR As Integer, NAC As Integer
    Dim NAT As Integer, TN As Integer, TFS As Integer, TFA As Integer, TAE As Integer
    Dim TSA As Integer, TAR As Integer, TAC As Integer, TAT As Integer, RN As Integer
    Dim RFA As Integer, RAE As Integer, RAR As Integer, RAC As Integer, RAT As Integer
    Dim FRR As Integer, FTR As Integer, FNR As Integer, SNR As Integer, STR As Integer
    Dim SRR As Integer, S1 As Integer, S2 As Integer, S3 As Integer, S4 As Integer, S As Integer

    Worksheets("OC Curve Calcs").Range("B5").Select
    Set AZ = Worksheets("OC Curve Calcs").Range("B5").Value ' Scheme evaluation? (Yes, No)
    Set I = Worksheets("OC Curve Calcs").Range("B10").Value ' Inspection Level (S1, S2, S3, S4, I, II, III)
    Set L = Worksheets("OC Curve Calcs").Range("B33").Value ' Lot Size (integer value)
    Set Flag = Worksheets("OC Curve Calcs").Range("I1").Value ' Flag indicating that 100% inspection is necessary
    Set Flag2 = Worksheets("OC Curve Calcs").Range("I2").Value ' Flag indicating that single sampling is necessary
    Set AQL = Worksheets("OC Curve Calcs").Range("B30").Value ' AQL Value (.015, .025, ..., 65, 100)
    Set SP = Worksheets("OC Curve Calcs").Range("B7").Value ' Single or Double Sampling Plan? (Single, Double)

    I don't see any misspellings and I have tried to follow the books I have on VBA. Something is not right and I need other more experienced eyes to look at this. Any help will be greatly appreciated.

    Dean

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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