Results 1 to 4 of 4

How to change a variable using select case

Threaded View

  1. #1
    Registered User
    Join Date
    02-03-2012
    Location
    Greece
    MS-Off Ver
    Excel 2010
    Posts
    23

    How to change a variable using select case

    I have the code shown below and i want to shorten it through a loop.
        Select Case ComboBox5.ListIndex
            Case 0: Rowa = 1
                    Call ActivateRow
    
            Case 1: Rowa = 2
                    Call SelectCombobox1
    
            Case 2: Rowa = 3
                    Call SelectCombobox1
    
            Case 3: Rowa = 4
                    Call SelectCombobox1
    
            Case 4: Rowa = 5
                    Call SelectCombobox1
    
            Case 5: Rowa = 6
                    Call SelectCombobox1
    
            Case 6: Rowa = 7
                    Call SelectCombobox1
    
            Case 7: Rowa = 2
                    Call SelectCombobox2
    
            Case 8: Rowa = 3
                    Call SelectCombobox2
    
            Case 9: Rowa = 4
                    Call SelectCombobox2
    End Select
    I wrote this, but didn't work. It seems that j and k increase their value every time i run the select case method and not when case 0 to 9 are been called.

            
        Select Case ComboBox5.ListIndex    
                 Case 0: Rowa = 1
                        Call ActivateRow
                        j = 1
                        
                Case 1 To 6
                        Rowa = j + 1
                        j = j + 1
                        Call SelectCombobox1
                        k = 1
    
                Case 7 To 9
                        Rowa = k + 1
                        k = k + 1
                        Call SelectCombobox2
    End Select
    Last edited by ref; 02-16-2012 at 12:02 PM.

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