Results 1 to 15 of 15

Useform on change modify code by ComboBox2 YES/NO entry

Threaded View

  1. #1
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Useform on change modify code by ComboBox2 YES/NO entry

    I have a userform which searches a database of numbered entries, returning all instances of the search word in textbox6 from two columns of the database.

    The final control will be ComboBox2 (a YES NO choice)

    If YES the code is to remove entries from the retrieved listings that begin with "20" only

    If NO the code is to remove entries from the retrieved listings that begin with "19" only

    How can I adapt the following

    Private Sub TextBox6_Change()
        Dim a, i As Long, w(), n As Long
        Me.ListBox4.Clear
        If Me.TextBox6.Value = "" Then Exit Sub
        a = Sheets("ewccodes").Cells(1).CurrentRegion.Value
        For i = 2 To UBound(a, 1)
            If UCase$(a(i, 3)) Like "*" & UCase$(Me.TextBox6.Value) & "*" Or UCase$(a(i, 4)) Like "*" & UCase$(Me.TextBox6.Value) & "*" Then
                n = n + 1
                ReDim Preserve w(1 To UBound(a, 2), 1 To n)
                For ii = 1 To UBound(a, 2)
                    w(ii, n) = a(i, ii)
                Next
            End If
        Next
    
        If n > 0 Then Me.ListBox4.Column = w
    
    End Sub
    Any help appreciated
    Last edited by nigelog; 12-09-2016 at 11:01 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Need to modify VBA code to move Entries between Worksheets based on Drop-down Entry
    By loydancer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2015, 01:56 AM
  2. Modify Useform Plase Help Me!
    By amador in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2014, 12:46 PM
  3. Modify call overall useform!
    By amador in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-03-2014, 02:43 AM
  4. VBA data entry Useform help
    By sa.1985 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-25-2012, 04:03 AM
  5. Using Entry of ComboBox1 to decide the entries of ComboBox2 using Excel Columns
    By sungodking in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-12-2012, 08:11 AM
  6. Using Entry of ComboBox1 to decide the entries of ComboBox2 using Excel Columns
    By sungodking in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2012, 06:51 AM
  7. Modify code to show message box on duplicate entry
    By twofootgiant in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-24-2011, 07:50 AM

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