+ Reply to Thread
Results 1 to 3 of 3

Case inside a Case throws error 424

Hybrid View

Jon.R Case inside a Case throws... 01-07-2013, 06:52 PM
protonLeah Re: Case inside a Case throws... 01-07-2013, 08:45 PM
Jon.R Re: Case inside a Case throws... 01-08-2013, 12:36 AM
  1. #1
    Registered User
    Join Date
    06-09-2011
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    17

    Question Case inside a Case throws error 424

    Hey guys, just a quick question regarding error 424, object required.

    I have a module, which upon loading, needs to populate several text boxes, check boxes and drop-down lists based on information in a sheet. Once a row is selected, and the module is chosen, it loads. Well, here is the Initialize info:

    Private Sub UserForm_Initialize()
    For Each Number In ActiveWorkbook.Worksheets("ClientDatabase").Range("A" & PKRow, "CS" & PKRow)
        Select Case Number.Column
            Case "1"
               'CODE
           'CASES #2-97 with CODE in each to change value of checkboxes and others
            Case "98"
                Select Case Number.Value
                    Case "1" Or "01"
                        OptionButton36.Value = True
                    Case "2" Or "02"
                        OptionButton35.Value = True
                    Case Number.Value.Length < 1
                        OptionButton35.Value = Null And OptionButton36.Value = Null
                End Select
        End Select
    Next Number
    End Sub
    The problem lies in when I comment out the code below Case "98" the program runs just fine, however when it is uncommented I run into an error 424 and it claims that the module doesn't exist. Perhaps there is a much better way this could be done, but any insight is much appreciated!

    Thanks,
    Jon

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,920

    Re: Case inside a Case throws error 424

    CS is column 97 so the code for column 98 is never executed. Also, column numbers are long integers not strings so the cases should be written
    Case 1 not Case "1"
    Case 98 not Case "98"
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    06-09-2011
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Case inside a Case throws error 424

    Thanks for the reply pro. Fixed the column numbering to "case x" and extended the column across to column 98. It is still throwing an error 424. I am starting to look into memory issues. But anyone with any insight is greatly appreciated!

    **Edit**

    OK, I "fixed" the issue with

    On Error Resume Next

    Anyone with any input greatly appreciated however, Thanks!
    Last edited by Jon.R; 01-08-2013 at 03:44 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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