Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is it possible to call a UserForm multiple times?
I have some simple code, which compares cells in two adjacent columns. If any two cells in one row are not equal, it displays a UserForm. When I call the UserForm, I use a vbModeless command, so that calling this UserForm does not stop the rest of the macro. Example:
UserForm2.Show vbModeless Since I have a lot of numbers changing, I need to have the userform pop up many times, each time the two cells in any row are not equal. Using the above line of code, can the UserForm be called and appear on the screen multiple times? Thank you. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is it possible to call a UserForm multiple times?
Yes but you have to create them as new objects like this.
Dim xlFrm As frmNew '' or whatever you named it. Set xlFrm = New frmNew1 xlFrm.Caption = "TEST" xlFrm.Show vbmodaless That will let you create a bunch of them but closing them is a little harder you will need some type of unique identifier on all of them then loop thru all forms to find the one that needs to be closed and then hide or unload it. Something like For i = 0 to UserForms.count -1 if userforms(i)."what ever you use to hold ID" = "what you are looking for.." userforms(i).hide endif next i Keith www.kjtfs.com --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is it possible to call a UserForm multiple times?
Doug,
No you won't be able to. You can issue the command multiple times, but as it is already in memory, it will reuse that same userform. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Doug" wrote in message ... I have some simple code, which compares cells in two adjacent columns. If any two cells in one row are not equal, it displays a UserForm. When I call the UserForm, I use a vbModeless command, so that calling this UserForm does not stop the rest of the macro. Example: UserForm2.Show vbModeless Since I have a lot of numbers changing, I need to have the userform pop up many times, each time the two cells in any row are not equal. Using the above line of code, can the UserForm be called and appear on the screen multiple times? Thank you. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is it possible to call a UserForm multiple times?
KJTFS
Thank you. The code you posted worked like a charm. And if I put a Command Button on the Form, and put in the following code for hte button Private Sub CommandButton1_Click( Me.Hid End Su It will only close out that UserForm, not all the UserForms. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is it possible to call a UserForm multiple times?
Welcome, and thats good.
Keith www.kjtfs.com ~× wrote: *KJTFS, Thank you. The code you posted worked like a charm. And if I put Command Button on the Form, and put in the following code for ht button: Private Sub CommandButton1_Click() Me.Hide End Sub It will only close out that UserForm, not all the UserForms. -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to keep UserForm open at all times while excel is running | Excel Discussion (Misc queries) | |||
Call Center Talk Times | Excel Worksheet Functions | |||
Peak call times/hours | Excel Worksheet Functions | |||
Macro to call-up UserForm | Excel Worksheet Functions | |||
Call Center Management: How to calculate 'cost per call' | Excel Discussion (Misc queries) |