Solved

Excel VBA - Refresh Modeless Userform

Posted on 2014-04-21
4
3,271 Views
Last Modified: 2014-04-21
I have created a modeless userform that loads spreadsheet data when it initialises.  If the spreadsheet is edited with the form open i would like the data in the userform to update.  Is simply adding a "refresh" button on the form (that effectively closes and reopens it) the way to go or is a worksheet change event better?
Chart-Userform.xlsm
0
Comment
Question by:JohnNZExcel
  • 2
  • 2
4 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
Comment Utility
It depends how live you want it to be. A Worksheet_Change event will keep the data more up to date than a button.
0
 

Author Comment

by:JohnNZExcel
Comment Utility
Thanks for your interest in the Question.  The actual project worksheet has approximately 100 drop down boxes that are used for building a session plan and each change will slightly alter the content of the information and chart that is loaded on the userform.  I think a button will spare the system resources and make the spreadsheet work faster.  What do you think?
Assuming a "refresh" button is the way to go - do you think unloading and then re-opening the form to run the initialize code is the simplest method or can i attach the initialize code to a simple command button on the form and get the same effect?
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
Comment Utility
If you need to run the complete code, just call Userform_Initialize from the button click directly. If not, move the code you do need into a separate routine and call that from both the Initialize event and the button Click event.
0
 

Author Comment

by:JohnNZExcel
Comment Utility
Great, thanks for your assistance
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now