Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Hello,
I am trying to create a custom dialog box that will allow me to have the user clarify an entry when a checkbox is checked. I want them to be able to select something from a list that I have created. I have created the popup in Excel but cannot find out how to call the popup into the display when the checkbox is checked. Can anyone help me please? |
#2
![]() |
|||
|
|||
![]()
Is this a checkbox on the worksheet?
If yes, then if it's a checkbox from the Forms toolbar, assign this macro to the checkbox: Option Explicit Sub testme() Dim myCBX As CheckBox Set myCBX = ActiveSheet.CheckBoxes(Application.Caller) If myCBX.Value = xlOn Then UserForm1.Show End If End Sub If it's a checkbox from the control toolbox toolbar, then double click on that checkbox (while in design mode) and use this kind of code: Option Explicit Private Sub CheckBox1_Click() If Me.CheckBox1.Value = True Then UserForm1.Show End If End Sub Brad Sumner wrote: Hello, I am trying to create a custom dialog box that will allow me to have the user clarify an entry when a checkbox is checked. I want them to be able to select something from a list that I have created. I have created the popup in Excel but cannot find out how to call the popup into the display when the checkbox is checked. Can anyone help me please? -- Dave Peterson |
#3
![]() |
|||
|
|||
![]()
The check box is a VB Control from the Control Toolbox. The name of the
popup is "Popup" it is a MS Excel 5.0 Dialog form. If you could help me in explaining the code you put in some of it I understand from programming VB but other parts of it I am not sure why it is there and all. "Dave Peterson" wrote: Is this a checkbox on the worksheet? If yes, then if it's a checkbox from the Forms toolbar, assign this macro to the checkbox: Option Explicit Sub testme() Dim myCBX As CheckBox Set myCBX = ActiveSheet.CheckBoxes(Application.Caller) If myCBX.Value = xlOn Then UserForm1.Show End If End Sub If it's a checkbox from the control toolbox toolbar, then double click on that checkbox (while in design mode) and use this kind of code: Option Explicit Private Sub CheckBox1_Click() If Me.CheckBox1.Value = True Then UserForm1.Show End If End Sub Brad Sumner wrote: Hello, I am trying to create a custom dialog box that will allow me to have the user clarify an entry when a checkbox is checked. I want them to be able to select something from a list that I have created. I have created the popup in Excel but cannot find out how to call the popup into the display when the checkbox is checked. Can anyone help me please? -- Dave Peterson |
#4
![]() |
|||
|
|||
![]()
Option Explicit
Private Sub CheckBox1_Click() If Me.CheckBox1.Value = True Then ThisWorkbook.DialogSheets("popup").Show End If End Sub The checkbox control from the control toolbox toolbar has events that can be captured. By double clicking on that checkbox, you get to the VBE and the code window behind that worksheet. And you get the _click event (by default). The me. refers to the worksheet holding the checkbox. It checks to see if the checkbox is checked. If it is, it displays the popup dialog. Brad Sumner wrote: The check box is a VB Control from the Control Toolbox. The name of the popup is "Popup" it is a MS Excel 5.0 Dialog form. If you could help me in explaining the code you put in some of it I understand from programming VB but other parts of it I am not sure why it is there and all. "Dave Peterson" wrote: Is this a checkbox on the worksheet? If yes, then if it's a checkbox from the Forms toolbar, assign this macro to the checkbox: Option Explicit Sub testme() Dim myCBX As CheckBox Set myCBX = ActiveSheet.CheckBoxes(Application.Caller) If myCBX.Value = xlOn Then UserForm1.Show End If End Sub If it's a checkbox from the control toolbox toolbar, then double click on that checkbox (while in design mode) and use this kind of code: Option Explicit Private Sub CheckBox1_Click() If Me.CheckBox1.Value = True Then UserForm1.Show End If End Sub Brad Sumner wrote: Hello, I am trying to create a custom dialog box that will allow me to have the user clarify an entry when a checkbox is checked. I want them to be able to select something from a list that I have created. I have created the popup in Excel but cannot find out how to call the popup into the display when the checkbox is checked. Can anyone help me please? -- Dave Peterson -- Dave Peterson |
#5
![]() |
|||
|
|||
![]()
Thanks for your help so far, I would ask for a little more help with
recovering the data from the popup. The popup has a listbox and the Ok and Cancel buttons, the listbox is populated with data from a worksheet. when I have clicked on the listbox, the field where you can name cell ranges shows the name List Box 5. I tried to use the in the VB code and it gave errors. I am not sure how to recover the selected item from the list. |
#6
![]() |
|||
|
|||
![]()
I think if you post the code, it would help.
Brad Sumner wrote: Thanks for your help so far, I would ask for a little more help with recovering the data from the popup. The popup has a listbox and the Ok and Cancel buttons, the listbox is populated with data from a worksheet. when I have clicked on the listbox, the field where you can name cell ranges shows the name List Box 5. I tried to use the in the VB code and it gave errors. I am not sure how to recover the selected item from the list. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating custom list with a comma in it | Excel Discussion (Misc queries) | |||
Creating custom chart legen pallettes/styles symbols | Charts and Charting in Excel | |||
Creating an custom input box | Excel Worksheet Functions | |||
Creating custom colours in Excel 2002 | Excel Discussion (Misc queries) |