+ Reply to Thread
Results 1 to 8 of 8

Combox list with Collection, list getting updated multiple time

  1. #1
    Registered User
    Join Date
    07-26-2017
    Location
    Pune
    MS-Off Ver
    2013
    Posts
    9

    Smile Combox list with Collection, list getting updated multiple time

    Thanks

    bakerman2 & AMYasserKhalil, AMjindon. Helping me. I was stunk in this from last two days but in sort time you people resolved my problem. I appreciate your help and work.

    Thanks and regards
    upguy


    Hello Experts,
    I have created combo box with using of collection, I have list a (data) in sheet1 range("A1") to Last row (variable). I have added combo-box item with collection.


    I am facing issue the number of time I click on Drop down of combo-box the list is updating that number of time.

    Please help me to resolve this. I am new to VBA.

    Thanks an regards.

    upguy
    Attached Files Attached Files
    Last edited by upguy; 08-15-2017 at 10:34 PM. Reason: Great Answer in short time

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Combox list with Collection, list getting updated multiple time

    Hello
    Put your code in another event
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Registered User
    Join Date
    07-26-2017
    Location
    Pune
    MS-Off Ver
    2013
    Posts
    9

    Re: Combox list with Collection, list getting updated multiple time

    Sorry in last mail I have not give the code, Please find the code.

    Below is a code:-

    Private Sub ComboBox1_DropButtonClick()
    Dim ColList As Collection
    Dim Lr As Long, I As Long, J As Long

    Lr = Sheet1.Range("A1").Cells(Rows.Count, 1).End(xlUp).Row

    Set ColList = New Collection

    With Sheet1.Range("A1").Resize(Lr)
    For I = 2 To Lr
    ColList.Add .Cells(I, 1).Value, CStr(.Cells(I, 1))
    Next

    For J = 1 To ColList.Count
    Me.ComboBox1.AddItem ColList(J)
    Next

    End With
    End Sub

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Combox list with Collection, list getting updated multiple time

    I didn't understand what you're after. I think you have to put the code in userform_Intialize event not in ComboBox1_DropBuutonClick

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Combox list with Collection, list getting updated multiple time

    Replace
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-26-2017
    Location
    Pune
    MS-Off Ver
    2013
    Posts
    9

    Re: Combox list with Collection, list getting updated multiple time

    Private Sub UserForm_Initialize()
    Dim ColList As Collection
    Dim Lr As Long, I As Long, J As Long

    Lr = Sheet1.Range("A1").Cells(Rows.Count, 1).End(xlUp).Row

    Set ColList = New Collection

    With Sheet1.Range("A1").Resize(Lr)
    For I = 2 To Lr
    ColList.Add .Cells(I, 1).Value, CStr(.Cells(I, 1))
    Next

    For J = 1 To ColList.Count
    Me.ComboBox1.AddItem ColList(J)
    Next
    End With

    Lr1 = Sheet1.Range("b1").Cells(Rows.Count, 1).End(xlUp).Row

    With Sheet1.Range("b1").Resize(Lr1)
    For I = 2 To Lr1
    ColList.Add .Cells(I, 1).Value, CStr(.Cells(I, 1))
    Next

    For J = 1 To ColList.Count
    Me.ComboBox2.AddItem ColList(J)
    Next
    End With

    End Sub

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Combox list with Collection, list getting updated multiple time

    Please amend your posts to use Code Tags when posting code.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  8. #8
    Registered User
    Join Date
    07-26-2017
    Location
    Pune
    MS-Off Ver
    2013
    Posts
    9

    Re: Combox list with Collection, list getting updated multiple time

    Thanks

    bakerman2 & AMYasserKhalil, AMjindon. Helping me. I was stunk in this from last two days but in sort time you people resolved my problem. I appreciate your help and work.

    Thanks and regards
    upguy

+ 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. Pick one webpage each from a collection of web page list!
    By suvikkrishnan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2017, 05:40 AM
  2. How to pick one webpage each from a collection of web page list!!!
    By suvikkrishnan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2017, 04:53 AM
  3. Combox dropdown list
    By SMK612 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2016, 05:09 PM
  4. Combox to return unique value from a list with Multiple records
    By alex_shin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2013, 06:24 AM
  5. Excel Code run when combox list item is selected.
    By cllaguno in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-15-2013, 07:58 AM
  6. 1 Cell Automatically Updated per multiple list selections
    By DUrekew in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-28-2012, 12:38 PM
  7. Populate Validation list with Collection
    By CaroKannDefence in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2011, 05:07 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