Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel VBA - Multi sheet filtering/querying(?) & combo box woes
Hi People!
Easy one first - ;) , UserForm will not initialize on loading, unles user hits the Clear Form button first. But doing that appends ye another list to the combo boxes. Driving me nuts, and I'll bet th solution is staring me in the face Slightly more difficult one now - ;) I need to be able to sort through the sheets and return to a cell i the "Totals" sheet, a value for the number of Entrants paying for mor than one round. I have a column in each sheet containing the number (1, 2, or 3) they have paid for. Code follows:: ------------------------------------------------ Private Sub cmdClear_Click() Call frmInput_Initialize End Sub ------------------------------------------------ Private Sub cmdExit_Click() ActiveWorkbook.Sheets("Totals").Activate Unload Me End Sub ------------------------------------------------ Private Sub cmdUpdate_Click() 'Set appropriate worksheet as active for input If optMod = True Then ActiveWorkbook.Sheets("Modified").Activate ElseIf optSupSedan = True Then ActiveWorkbook.Sheets("SuperSedan").Activate ElseIf optModBike = True Then ActiveWorkbook.Sheets("ModBike").Activate ElseIf optStBike = True Then ActiveWorkbook.Sheets("StreetBike").Activate ElseIf optStreet = True Then ActiveWorkbook.Sheets("Street").Activate ElseIf optJun = True Then ActiveWorkbook.Sheets("Junior").Activate ElseIf optBurn = True Then ActiveWorkbook.Sheets("Burnout").Activate End If 'Find the next empty row for input Range("A3").Select Do If IsEmpty(ActiveCell) = False Then ActiveCell.Offset(1, 0).Select End If Loop Until IsEmpty(ActiveCell) = True 'Add data from form to worksheet row ActiveCell.Value = txtName.Value ActiveCell.Offset(0, 1) = txtNum.Value ActiveCell.Offset(0, 2) = cboPay.Value ActiveCell.Offset(0, 3) = txtAmount.Value If optOne = True Then ActiveCell.Offset(0, 4).Value = "1" ElseIf optTwo = True Then ActiveCell.Offset(0, 4).Value = "2" ElseIf optThree = True Then ActiveCell.Offset(0, 4).Value = "3" End If If optBurn = True Then ActiveCell.Offset(0, 5) = cboBurn.Value End If 'Call msgbox to see if any more input desired Dim Msg, Style, Title, Response ' Define messagebox content. Msg = "Entry Added - Do you want to add another entry ?" Style = vbYesNo ' Define buttons. Title = "Add Another Entry?" ' Define title. Response = MsgBox(Msg, Style, Title) If Response = vbYes Then ' User chose Yes. Call frmInput_Initialize ' Restart the form Else ' User chose No. Call cmdExit_Click ' Kill the form End If End Sub ----------------------------------------------- 'Set up the form for input Private Sub frmInput_Initialize() 'Clear all text inputs txtName.Value = "" txtNum.Value = "" txtAmount.Value = "" 'Set up the comboboxes With cboPay .AddItem "Cash" .AddItem "Cheque" .AddItem "Credit Card" .AddItem "Bank Transfer" End With With cboBurn .AddItem "4 Cyl" .AddItem "6 Cyl" .AddItem "8 Cyl" End With 'Set some defaults cboPay.Value = "Cash" cboBurn.Value = "" optOne.Value = True optMod.Value = True txtName.SetFocus End Sub ------------------------------------------- Private Sub UserForm_Click() End Sub ------------------------------------------- End code. Thanks in advance Do -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multi core and pivot table woes | Excel Discussion (Misc queries) | |||
Querying an excel sheet | Excel Discussion (Misc queries) | |||
Multi Column Combo Box | Excel Programming | |||
Multi Column Combo Box | Excel Programming | |||
Populating Sheet Data From A UserForm Combo Box Enabled For Multi-Choices | Excel Programming |