+ Reply to Thread
Results 1 to 15 of 15

Useform on change modify code by ComboBox2 YES/NO entry

  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

    Please Login or Register  to view this content.
    Any help appreciated
    Last edited by nigelog; 12-09-2016 at 11:01 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    Are you going to be removing from the array w?
    If posting code please use code tags, see here.

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

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    yes Norie, filtered out as as a possible choice in that instance

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    Try this (not tested).

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    Couldn't you just not add to the array instead of removing?

    Something like this psuedo-code perhaps.
    Please Login or Register  to view this content.

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

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    Thanks Norie, tried that but returning both options so no change. Definitely ComboBox2 but have a feeling ComboBox2 not being read.

    Tried a message box after If Then but no appearance

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

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    There is no instance where they will ever appear together if that makes a difference

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    Did you try the code in post #4 ?

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

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    yes, alpha, tried a few variations but didn't eliminate any entries beginning with 19 or 20

    column a entries 19 12 12 column b text column c text column d text
    searches columns c and d

  10. #10
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    Quote Originally Posted by nigelog View Post
    column a entries 19 12 12 column b text column c text column d text
    searches columns c and d
    I didn't understand this.

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

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    Just realised, the code searches the columns 3 and 4 and teturns all the data

    The number codes though are in column 1
    Last edited by nigelog; 12-09-2016 at 10:05 AM.

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

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    The codes do not appear in the searched columns but are also in the next column 5

    adapted code to
    Please Login or Register  to view this content.
    works perfectly, can use this for a few other requirements

    many thanks to Norie and jindon for original code

  13. #13
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    If the 20 or 19 are only in column 5 then you could use this...

    Please Login or Register  to view this content.

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

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    Unfortunately, I had left an instance of "19" and "20" in the right places in column 4 - giving a false return.

    The codes are in column 5 but this data is not being requested for return to listbox

    any ideas?????

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

    Re: Useform on change modify code by ComboBox2 YES/NO entry

    Spot on - Thanks AlphaFrog

    one day Ill get a better understanding of this code and its possibilities but small steps are still steps

+ 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. [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