LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Retaining Values in Userform when called a second time

I have a userform which I load values into via a combobox as follows below.
I want to load these values the first time the user calls the form up. After
load the form, the user then picks an item from the box and I pass this to a
public variable via the combobox change event. The user is then prompted
away from this form and then brought back later. Now when the user comes
back to this form again, I want to bypass the loading of the combobox but
instead retain the value from the public variable. How do I do this? I am
assuming an If stmt which tests to see if this is the first time the form has
been called or would you use a class module for this?



Private Sub UserForm_Initialize()
Dim pg As Control
Dim sht As Worksheet

With UserForm1.ComboBox1
.AddItem "Black"
.AddItem "Blue"
.AddItem "Red"
.AddItem "Green"
.AddItem "Yellow"
.AddItem "Orange"
.AddItem "White"
End With
End Sub

Private Sub ComboBox1_Change()
cmblistvalue = ComboBox1.Value
UserForm2.Label1.Caption = cmblistvalue
End Sub
 
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
Private Sub - Called from Userform pallaver Excel Discussion (Misc queries) 3 July 15th 08 08:41 AM
Userform to have Last Updated Values Time & Date Displayed ?? Corey Excel Programming 2 December 14th 06 03:15 AM
Passing a value from 1 userform to another when you dont know who called it. [email protected] Excel Programming 2 August 25th 06 04:11 PM
How to make userform disappear while called subroutine is running Cornelia Excel Programming 2 June 16th 06 10:47 PM
Opening a UserForm causes a crash in the Exit procedure (Which is never called) Brent McIntyre Excel Programming 0 May 12th 04 12:37 PM


All times are GMT +1. The time now is 08:29 AM.

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

About Us

"It's about Microsoft Excel"