UserForm_Initialize
Apr 1, 2008It is not Initializing.
Sub test()
UserForm1.Show
End Sub
Private Sub UserForm1_Initialize()
UserForm1.TextBox1.Value = 8
End Sub
It is not Initializing.
Sub test()
UserForm1.Show
End Sub
Private Sub UserForm1_Initialize()
UserForm1.TextBox1.Value = 8
End Sub
I need to understand the difference between userform_activate and userform_Initialize.
When do I use one or the other or both.
I have created a form containing a list box. This list box contains values (Items) that correspond to a particular product (i.e. each time I view a new product, I need to see a new list of items in the list box). I have used Userform_initialize to set the Items (see below). The values are themselves drawn from a spreadsheet. I have only pasted the piece of code in question - I have a lot more code prior to that in order to define the variable "varcount".
Userform_initialize
Dim w As Workbook
Dim varLine As Integer
Dim varcount As Integer
Dim vItem As String
Set w = ThisWorkbook
For counter = 1 To varcount
Selection. Offset(0, 0).Select
vItem = Selection.Value
frmCheckTwinSku.lbTwinSku.AddItem (vItem)
Selection.Offset(0, 1).Select
Next counter.........................
The below code tests a particular cell before displaying the userform. If Range ("Bal_BF") contains an error (such as "#N/a"), a message box is displayed and the form should NOT display.
However, the code is still trying to display the userform, and gives me a error message "Object variable or With Block variable not set".
When Bal_BF contains a value, the form displays correctly.
Private Sub UserForm_Initialize()
If Employee = "" Then Call Retrieve
If IsError(Range("Bal_BF")) Then
Call MsgBox("Your name doesn't appear in the Holiday & Absence file." & vbCr & vbCr & _
"Please see Leila Fretton or Neil Jimack about this.",.........
I have a userform used to insert new vehicle details onto a spreadsheet. below is the code used in two of the boxes to choose the service intervals and the engine type. There is another combobox on the form, however when I try the same type of code for more than 1 box I receive an error on the "Sub Userform_Initialize" line. I assume I need to change something on the 'Sub' line but I cannot figure out what!!
View 2 Replies View Related