Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Show checkbox checked on open
I need help.
I have 3 userforms. Userform1 has 2 buttons, one to start a new project and one that edits the project as saved. Which ever button is clicked brings up userform2 which has 5 checkboxes. What I would like to happen: when the edit button is clicked I would like the checkboxes that were checked the last time to show up as checked. The value of the checkboxes are stored on sheet3 in cells c2-c6. Thank you for your time and assistance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Show checkbox checked on open
You could probably set up a linked cell (control source) for each checkbox
which would hold the value of the checkbox until the form is reopened and will show that value upon open. "Solution4U" wrote: I need help. I have 3 userforms. Userform1 has 2 buttons, one to start a new project and one that edits the project as saved. Which ever button is clicked brings up userform2 which has 5 checkboxes. What I would like to happen: when the edit button is clicked I would like the checkboxes that were checked the last time to show up as checked. The value of the checkboxes are stored on sheet3 in cells c2-c6. Thank you for your time and assistance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Show checkbox checked on open
Could you show me an example of code for that? I am rather new to vba.
Thank you for the response. "JLGWhiz" wrote: You could probably set up a linked cell (control source) for each checkbox which would hold the value of the checkbox until the form is reopened and will show that value upon open. "Solution4U" wrote: I need help. I have 3 userforms. Userform1 has 2 buttons, one to start a new project and one that edits the project as saved. Which ever button is clicked brings up userform2 which has 5 checkboxes. What I would like to happen: when the edit button is clicked I would like the checkboxes that were checked the last time to show up as checked. The value of the checkboxes are stored on sheet3 in cells c2-c6. Thank you for your time and assistance. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Show checkbox checked on open
I would save setting values to registry.
paste this code in a standard module: (rename Userform1 as appropriate) Sub GetSettings() ' Reads default settings from the registry Dim ctl As Control Dim CtrlType As String For Each ctl In UserForm1.Controls CtrlType = TypeName(ctl) If CtrlType = "CheckBox" Then ctl.Value = GetSetting(AppName:="My Application", _ section:="CheckBox Settings", _ key:=ctl.Name, Default:=False) End If Next ctl End Sub Sub SaveSettings() ' Writes current settings to the registry Dim ctl As Control Dim CtrlType As String For Each ctl In UserForm1.Controls CtrlType = TypeName(ctl) If CtrlType = "CheckBox" Then SaveSetting AppName:="My Application", _ section:="CheckBox Settings", key:=ctl.Name, _ setting:=CStr(ctl.Value) End If Next ctl End Sub then add this code to the userform with checkboxes: Private Sub EditButton_Click() SaveSettings 'other code End Sub Private Sub UserForm_Initialize() GetSettings 'other code End Sub hope helps -- jb "Solution4U" wrote: I need help. I have 3 userforms. Userform1 has 2 buttons, one to start a new project and one that edits the project as saved. Which ever button is clicked brings up userform2 which has 5 checkboxes. What I would like to happen: when the edit button is clicked I would like the checkboxes that were checked the last time to show up as checked. The value of the checkboxes are stored on sheet3 in cells c2-c6. Thank you for your time and assistance. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Show checkbox checked on open
The method suggested does not require code. In the properties dialog box for
each checkbox there is a Control Source property. Select that property and type in a cell reference e.g. Sheet1!a1. Of course use a different cell for each checkbox, and choose a cell that will not be accesssed by users in the normal course of business to avoid inadvertant changes. The chosen cells will show True if the checkbox is checked and False if the checkbox is blank. These cell values are retained after the userform is closed and are automatically loaded into the checkbox when the userform is initialized again. "Solution4U" wrote: Could you show me an example of code for that? I am rather new to vba. Thank you for the response. "JLGWhiz" wrote: You could probably set up a linked cell (control source) for each checkbox which would hold the value of the checkbox until the form is reopened and will show that value upon open. "Solution4U" wrote: I need help. I have 3 userforms. Userform1 has 2 buttons, one to start a new project and one that edits the project as saved. Which ever button is clicked brings up userform2 which has 5 checkboxes. What I would like to happen: when the edit button is clicked I would like the checkboxes that were checked the last time to show up as checked. The value of the checkboxes are stored on sheet3 in cells c2-c6. Thank you for your time and assistance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Checkbox checked then show more checkboxes | New Users to Excel | |||
How to have Checkbox A uncheck with checked Checkbox B | Excel Discussion (Misc queries) | |||
Is checkbox is checked? | Excel Discussion (Misc queries) | |||
If Checkbox checked/notchecked then | Excel Programming | |||
checkbox - default checked or un-checked | Excel Programming |