Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
HELP!!! Beginner needs help with VBA coding
Hi all VBA genius:
I am a beginner of VBA and I am stuck with a certain code and hope you genius can help. I have a UserForm with 5 check boxes; 5 Frames, each with optYes, optNo, and optNA; one Frame with a combo box and an Enter button; one Frame with a text box and an Enter button. The layout of the UserForm is as follows: Chk09 optYes optNo optN/A Chk10 Chk11 optYes optNo optN/A Chk12 optYes optNo optN/A Chk13 optYes optNo optN/A Combo box Enter button Text box (for chk10) Enter button When the UserForm is initialized, it appears on Sheet 1 and only chk09 is visible on the UserForm, chk10 – chk13, all of the frames with option buttons, the frame with combo box / Enter button, and the frame with text box / Enter button are invisible. When a user clicks chk09, the corresponding frame with optYes, optNo, and optN/A appears. User will click one of the three options. When the user clicks optYes: 1. a “Yes” appears on H21 in Sheet 1 2. chk10 on Userform becomes visible and it is checked 3. the frame with the text box / Enter button appears 4. user inputs the text and hits the Enter button (the one with the text box) 5. text will appear on H23 in Sheet 1 6. chk11 on UserForm becomes visible When the user clicks optN/A: 1. a “N/A” appears on H21 in Sheet 1 2. Another “N/A” appears on H23 in sheet 1 3. chk11 on UserForm becomes visible When the user clicks optNo: 1. a “No” appears on H21 in Sheet 1 2. a “N/A” appears on H23 in Sheet 1 3. the frame with the combo box and Enter button appears 4. user selects one of the several statements from the combo box 5. user hits the Enter button (the one with the combo box) and transfer the statement to a predetermine cell in Sheet 2 6. chk11 on UserForm becomes visible The user will repeat the procedure until she answers all the questions. My problem is that I am able to make chk09, chk10, and chk11 visible but not chk12 and chk13. Once I clicked the Enter button (the one with the combo box) after clicking optNo at Frame 3, chk12 suppose to become visible; instead the focus went back to chk09. Here is the code I wrote for the Enter button with the combo box: 'Hide the combo box and the OK button after transferring respective concern to "Recap" Private Sub cmdGroundsEnter_Click() cmdGroundsEnter.Default = True Call chkUnhide 'Hide the frame FrameConcernGrounds.Visible = False 'Check for completeness If cmbConcernGrounds.Text = "" Then MsgBox "Please select the security concern" FrameConcernGrounds.Visible = True Exit Sub End If ' Find next available row NextRow = Sheets("Recap").Range("a5000").End(xlUp).Row + 1 ' Transfer the data Sheets("Recap").Cells(NextRow, 1) = Qnum Sheets("Recap").Cells(NextRow, 2) = Cat Sheets("Recap").Cells(NextRow, 4) = cmbConcernGrounds.Text & Chr(15) Sheets("Recap").Cells(NextRow, 7) = Action ' Reset the Userform for the next row cmbConcernGrounds = "" End Sub Here is the code I wrote for optNo09: 'Action to be performed when the "No" button is clicked Private Sub opt09No_Click() Sheets("Report").Range("H119") = "No" Sheets("Report").Range("H124") = "N/A" 'Show combo box in UserForm If opt09No = True Then FrameConcernGrounds.Visible = True 'Select the corresponding question number, category & Corrective Action Qnum = Sheets("RiskMatrix").Range("A2") Cat = Sheets("RiskMatrix").Range("b2") Action = Sheets("RiskMatrix").Range("c2") 'Select and show the corresponding concern in the combo box in UserForm cmbConcernGrounds.RowSource = "RiskMatrix!$e$2:$e$3" Else FrameConcernGrounds.Visible = False End If End Sub Here is the call procedure I wrote: Public Sub chkUnhide() Select Case CheckBox Case chk09.Value = True chk11.Visible = True Case chk11.Value = True chk12.Visible = True Case chk12.Value = True chk13.Visible = True End Select End sub Sorry for the long posting. I hope my problem is well illustrated Alex --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
HELP!!! Beginner needs help with VBA coding
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I'm an excel beginner please help | Excel Worksheet Functions | |||
Beginner question | Excel Discussion (Misc queries) | |||
2 questions from a beginner | New Users to Excel | |||
Macro for a beginner | Excel Discussion (Misc queries) | |||
Confused beginner | Excel Worksheet Functions |