Results 1 to 1 of 1

1004 Error:VB code to restrict the use of a combobox

Threaded View

  1. #1
    Registered User
    Join Date
    02-25-2008
    Posts
    2

    1004 Error:VB code to restrict the use of a combobox

    Hi Everyone,

    I have a small problem. I've got an excel sheet with comboboxes. I've written some VB code to restrict the use of a combobox depending on the preceding selection. The problem is that the code runs fine.. But when I create a new sheet or change a sheets name I get a 1004 error. Its not even the same sheet where the code is.. Can anyone shed some light on this for me? The code is below.

    Private Sub ComboBox2_Change()
    
    If Sheets("InputSheet").ComboBox2 = "Years" Then
    
    Sheets("InputSheet").ComboBox3.Enabled = False
    Sheets("InputSheet").ComboBox3.Value = ""
    
    End If
    
    If Sheets("InputSheet").ComboBox2 = "Quarters" Then
    
    Sheets("InputSheet").ComboBox3.Enabled = True
    
    End If
    
    If Sheets("InputSheet").ComboBox2 = "" Then
    
    Sheets("InputSheet").ComboBox3.Enabled = False
    
    End If
    
    
    
    End Sub

    Thanks in Advance and Enjoy your day
    Last edited by dominicb; 03-03-2008 at 10:08 AM.

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