Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello -
I recently got some help in building the code below (thanks Bernie!), but have a couple of questions about it ... 1) how do I call it from a Button? I tried changing the name of the button to match the Sub name and also tried 'Calling' the Sub from the button, but neither way worked for me ... 2) On Error, the code below should display a short msgbox and then then Exit when the user clicks "OK" -- instead, the code continues (and shows an empty userform) upon hitting OK -- why and how do I fix it? 3) As part of my testing, I changed the Sub name to 'test_initialize()' -- the blank userform popped rigtht up, but the msgbox was totally skipped (even though no data was present). Changing back to 'Userform_Initialize' fixed the problem ... is this just a built-in property of userforms? Please forgive the 'basic' questions ... I'm just starting to use userforms! TIA, Ray Private Sub Userform_Initialize() Dim myR As Range Dim myCell As Range Dim mySA() As String Dim i As Integer On Error GoTo NoCells Set myR = Worksheets("Admin").Range("G39:G68") _ .SpecialCells(xlCellTypeConstants) ' Load UserForm1 ReDim mySA(0 To myR.Cells.Count, 0 To 1) On Error GoTo 0 i = 0 For Each myCell In myR mySA(i, 0) = myCell.Value mySA(i, 1) = myCell(1, 2).Value i = i + 1 Next myCell UserForm1.ListBox1.List = mySA ' UserForm1.Show NoCells: MsgBox "No stores were late!", vbExclamation Exit Sub End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
code modules included in sheet count? | Excel Programming | |||
how do i change or make this macro??? pictures and code included | Excel Programming | |||
how do i change or make this macro??? pictures and code included | Charts and Charting in Excel | |||
Run-time error '9' ---- Code to fix included. | Excel Programming | |||
Require extra funtionality - existing code included | Excel Programming |