Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help! Please help with my code
Hi all VBA genius:
Can someone help me with the following? 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, only chk09 is visible on the UserForm. When user checks chk09, the corresponding frame with optYes, optNo, and optN/A appears. If user selects optNo, the combo box and the Enter button appear. When user clicks the Enter button, chk11 appears. This procedure runs every time the user chooses ¡§No¡¨ and then hits the Enter button. My problem is that I am able to make chk09, chk10, and chk11 visible but not chk12 and chk13 when user clicks the enter button. How can I make it work? 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 Alex --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Convert a Number Code to a Text Code | Excel Discussion (Misc queries) | |||
copying vba code to a standard code module | Excel Discussion (Misc queries) |