+ Reply to Thread
Results 1 to 10 of 10

Userform refresh problem

  1. #1
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Userform refresh problem

    Hi,

    I have Userform which needs to be refreshed when selecting different sheet.

    Problem is that I want Listindex of combobox to be same as Activesheet name, when userform Initializes. After changing combobox Listindex I want to jump to other sheet,
    and refresh Userform's data.

    Here are the steps of my code in order, when opening Userform :

    1. CMdbutton macro :
    Please Login or Register  to view this content.

    2. Initialize_event (red coloured lines trigger Combobox Listindex, therefore combobox change_event is activated - here is the problem)
    Please Login or Register  to view this content.
    3. Combobox_change event
    Please Login or Register  to view this content.
    Code works, but userform does not Unload so comboboxes duplicate It's entries every time. I tried Unload Me in combobox change event, but not working.

    What else can I do to ?....Sample attached !
    Attached Files Attached Files
    Last edited by Lukael; 09-03-2015 at 01:34 AM.

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

    Re: Userform refresh problem

    If you had used my code in your previous question you wouldn't have had this problem.
    That was exactly what i had done , select sheet, jump to sheet and refresh userform data.

  3. #3
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Userform refresh problem

    Hi bakerman, thanks for response. Your code works great in sample, I tried It. But unfortunatelly complete code in original workbook contains lots of more objects and functions in Userform that needs to be updated, so Unloading userform is necessary.

    You recommend to follow your procedure and do that for everything that needs refresh ?

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Userform refresh problem

    What action is triggering the re-running of the Initialize event?
    Do you have any code that calls the Intialize procedure?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Userform refresh problem

    Yes, the third code as in post#1. I call Userform_initialize event again to display records of active sheet. Unload doesn't work.

    I just want a way to reopen Userform when combobox change event is triggered. But unfortunally that event is triggered even when Userform is opened on first time, because I need combobox to show listindex with name of active sheet.

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

    Re: Userform refresh problem

    How about this.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Userform refresh problem

    No, userform still needs to be refreshed when sheet is changed, without duplicating combobox Listindexes. So this code needs changes too:

    Please Login or Register  to view this content.
    A simple Cmdbutton for "refresh" on Userform with Unload me & Userform1.show does the trick, but I want to do this automatically...
    Last edited by Lukael; 09-03-2015 at 02:55 AM.

  8. #8
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Userform refresh problem

    Obviously no easy solution regarding this issue, and I tried many things. I decided to add Cmdbutton for re-opening Userform as mentioned in post #7, so I'm closing this thread.

  9. #9
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Userform refresh problem

    maybe so
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Userform refresh problem

    Wow, nicely done nilem ! It works, what a great solution ! Thanks man, you rock

+ 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] Refresh image on userform
    By Graham S in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-27-2021, 06:39 AM
  2. Refresh Treeview on UserForm
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-17-2015, 09:10 AM
  3. Identifying Cause Of UserForm Refresh
    By RowanB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2013, 06:22 AM
  4. [SOLVED] Refresh UserForm after entering data in another userform
    By s2jrchoi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-30-2013, 10:34 AM
  5. Refresh Label in Userform Vba
    By jdasp49 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2013, 02:27 PM
  6. Userform refresh not showing
    By Alfaholic in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-27-2009, 03:06 PM
  7. VBA+API refresh userForm
    By Greg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2006, 03:05 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