Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to keep UserForm open at all times while excel is running NFL Excel Discussion (Misc queries) 1 July 8th 09 01:35 AM
Call Center Talk Times Randy Rich Excel Worksheet Functions 12 August 27th 08 07:35 PM
Peak call times/hours Ber Excel Worksheet Functions 2 July 14th 08 10:26 AM
Macro to call-up UserForm Mr. G. Excel Worksheet Functions 0 August 24th 06 09:24 AM
Call Center Management: How to calculate 'cost per call' Denniso6 Excel Discussion (Misc queries) 2 June 25th 06 05:01 PM


All times are GMT +1. The time now is 01:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"