+ Reply to Thread
Results 1 to 8 of 8

enable/disable combobox based on textbox entry

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    enable/disable combobox based on textbox entry

    Hi I have this a userform where users enter data. first they enter a string of number into textbox4, and macro checks against the worksheet if this number exists. If it exists, then enable combobox3. if it does not exists and combobox2 selection is "Others", then disable combobox3. this is the code im using and I cant get it to work. Can anyone help please?

    Private Sub TextBox4_Change()
        Dim frow
        
        If TextBox4.Text = "" Then
        TextBox5.Text = ""
        End If
        
        With Sheets("Sheet1")
            frow = Application.Match((TextBox4.Text), .Columns(1), 0)
            If IsError(frow) And ComboBox2.Value <> "Others" Then
            TextBox5.Text = ""
            CommandButton4.Enabled = True
            ComboBox3.Enabled = True
            
            End If
        End With
        
        With Sheets("Sheet1")
            frow = Application.Match((TextBox4.Text), .Columns(1), 0)
            If IsError(frow) And ComboBox2.Value = "Others" Then
            ComboBox3.Enabled = False
            
            End If
        End With
       
            
        
        
    With Sheets("Sheet1")
            frow = Application.Match((TextBox4.Text), .Columns(1), 0)
            If Not IsError(frow) Then
            If .Cells(frow, 5).Value <> vbNullString And .Cells(frow, 7).Value = vbNullString Then
            TextBox5.Text = "Case is already in storage. Placed in " & .Cells(frow, 2).Value & " in Division " & .Cells(frow, 3).Value & " Box " & .Cells(frow, 4).Value & " by " & .Cells(frow, 5).Value & " on " & .Cells(frow, 6).Value: foundrow = frow
            CommandButton4.Enabled = False
            ComboBox1.Enabled = False
            ComboBox2.Enabled = False
            ComboBox3.Enabled = False
            ElseIf .Cells(frow, 12).Value <> vbNullString And .Cells(frow, 14).Value = vbNullString Then
            TextBox5.Text = "Case is already in storage. Placed in " & .Cells(frow, 9).Value & " in Division " & .Cells(frow, 10).Value & " Box " & .Cells(frow, 11).Value & " by " & .Cells(frow, 12).Value & " on " & .Cells(frow, 13).Value: foundrow = frow
            CommandButton4.Enabled = False
            ComboBox1.Enabled = False
            ComboBox2.Enabled = False
            ComboBox3.Enabled = False
            ElseIf .Cells(frow, 14).Value <> vbNullString Then
            TextBox5.Text = "Case returned by " & .Cells(frow, 14).Value & " on " & .Cells(frow, 15).Value: foundrow = frow
            CommandButton4.Enabled = False
            ComboBox1.Enabled = False
            ComboBox2.Enabled = False
            ComboBox3.Enabled = False
            Else
            TextBox5.Text = ""
            CommandButton4.Enabled = True
            ComboBox1.Enabled = True
            ComboBox2.Enabled = True
            ComboBox3.Enabled = True
            End If
            End If
        End With
    
        
    End Sub

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: enable/disable combobox based on textbox entry

    It might be easier for someone to help you out with this if you could attach a sample workbook with your userform along with the code you are using.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    Re: enable/disable combobox based on textbox entry

    sorry about that. attached workbook as per request
    Attached Files Attached Files

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: enable/disable combobox based on textbox entry

    You might have to try again, it wont open. Try saving it as a macro enabled file.

  5. #5
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    Re: enable/disable combobox based on textbox entry

    how about now?
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    Re: enable/disable combobox based on textbox entry

    any help please?

  7. #7
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    Re: enable/disable combobox based on textbox entry

    I solved it already, thanks to those who tried to render help

  8. #8
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: enable/disable combobox based on textbox entry

    Sorry about that, I haven't been on in a few days so I didn't get a chance to look at you new attached workbook. I'm glad you were able to get it figured out though.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. TextBox Entry based on Combobox Selection
    By tigerdel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-04-2016, 01:12 PM
  2. Combobox enable textbox
    By jpernice in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-24-2015, 09:16 PM
  3. [SOLVED] Enable Disable spin button based on a textbox
    By forrestgump1980 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2015, 07:21 AM
  4. [SOLVED] Enable and disable a cell based on a combination
    By Tandrima in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-25-2012, 12:26 PM
  5. Check Box Enable/Disable Based On Value From VLookup
    By sgp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-04-2011, 05:57 AM
  6. How to Enable/Disable the Option Button(s) based on different ComboBox Values?
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2011, 04:32 PM
  7. [SOLVED] textbox disable scrollbars enable
    By herb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2006, 08:40 PM

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