+ Reply to Thread
Results 1 to 6 of 6

VBA How to refresh a userform per button without restarting it.

  1. #1
    Registered User
    Join Date
    08-15-2013
    Location
    Lugano, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    22

    Question VBA How to refresh a userform per button without restarting it.

    Hello to all…

    I would like to declare that i am an Excel newbie, so please be patient with me.
    I am working for the first time ever with VBA and I have barely started my project and I am stuck already.

    Could anybody tell me how to refresh a userform using a commandButton so the userform dosent need to be restarted.
    To explain a little more, the cell values in my textboxes are basic entries and can be manualy modified in the userform and sent back to their cells. These cell values are part of a formula to calculate whitin the entire workbook and the results go in to an other cell witch is displayed again in my userform (or should be). Now when I send basic entries back to their cells, excel calculates but the results do not change in my userform because the userform only displays the values caled in the inicial (UserForm_Initialize()) I would like to create a button that refreshes the textbox and frame contents of my userform after modification without restarting the userform, or better integrate the code in my button that sends the values back to excel. That way it would not require an aditional button.

    I hope my explanation is understandable… English is not my first language….

    Thanks in advance for your help.
    Last edited by prohmex; 08-16-2013 at 02:05 PM.

  2. #2
    Registered User
    Join Date
    07-05-2013
    Location
    North Carolina, US
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: VBA How to refresh a userform per button without restarting it.

    if you can use a listbox for this, you can do:

    listbox.rowsource = [the range of the source cell]

    and the listbox will mirror what's in the cell or range of cells.

  3. #3
    Registered User
    Join Date
    08-15-2013
    Location
    Lugano, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: VBA How to refresh a userform per button without restarting it.

    Thanks for your help dshj its very much apreciated,
    I dont know about the listbox. Because it is a very large userframe and i am already about 300 lines of code in to it.
    Isent there an easyer way to refresh the entire userframe without restarting it. Just like the refresh button here in your web browser.

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA How to refresh a userform per button without restarting it.

    Or maybe try the worksheet_calculate event like:
    Please Login or Register  to view this content.
    You would have to change the names to suit.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  5. #5
    Registered User
    Join Date
    08-15-2013
    Location
    Lugano, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: VBA How to refresh a userform per button without restarting it.

    Thanks XeRo Solus,
    Can i place this (Worksheet_Calculate()) in a button code? And i guess i would have to insert every single TextBox that i want updated(about 150-200 textboxes and lables). Is it posible to place this code in a separate module and load the module in the userform button?(only to keep another 300 lines of code away from the UserForm1 Code page...to keep the overview)

  6. #6
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA How to refresh a userform per button without restarting it.

    Yes you could, if you wanted it to happen on a button click instead.

+ 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. Pausing and restarting a macro using a button
    By Bonnister in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2012, 03:43 PM
  2. Userform Option Button to Show/Hide Another Option Button on same Userform
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2010, 09:44 AM
  3. VBA+API refresh userForm
    By Greg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2006, 03:05 AM
  4. Refresh Button
    By Iguss in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-17-2005, 04:15 PM
  5. [SOLVED] Looping procedure calls userform; how to exit loop (via userform button)?
    By KR in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-27-2005, 08: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