Excel: Update a cell when a checkbox is clicked (Control Toolbox toolbar) in Excel 2003/XP/2000/97
Question: In Excel 2003/XP/2000/97, is there a way to link a check box to another cell? For example, I've made a checkbox and whenever the checkbox is clicked, I would like the current date to automatically appear in another cell. Is this possible?
Also I would like the date to not change whenever the worksheet is opened. For example, if a cell has been set to July 16th and the worksheet is opened on July 17th, I still want the cell to read as July 16th.
Answer: Because you don't want the cell value changing whenever the spreadsheet "recalculates", we'll have to create a macro to determine when to update the cell value.
Let's take a look at an example.
Download Excel spreadsheet (as demonstrated below)

In our spreadsheet, there are two columns - column A contains a checkbox and column B contains the "linked" cell.
We've created various checkboxes in column A using the Control Toolbox toolbar. To view the Control Toolbox toolbar, select Toolbars > Control Toolbox under the View menu.
When the checkbox in column A is "checked", the associated cell in column B will be updated with the current system date. When the checkbox is "unchecked", the associated cell value will be cleared.
This is accomplished with a macro called Process_Checkbox. You can view the macro by pressing Alt-F11.
The macro determines what row the checkbox resides in and then "sets the value" of the associated cell in column B.
Macro Code:
The macro code looks like this:
Sub Process_CheckBox(pObject)
Dim LRow As Integer
Dim LRange As String'Find row that checkbox resides in
LRow = pObject.TopLeftCell.Row
LRange = "B" & CStr(LRow)'Change date in column B, if checkbox is checked
If pObject.Value = True Then
ActiveSheet.Range(LRange).Value = Date'Clear date in column B, if checkbox is unchecked
Else
ActiveSheet.Range(LRange).Value = Null
End IfEnd Sub
Private Sub CheckBox1_Click()
Process_CheckBox CheckBox1
End SubPrivate Sub CheckBox2_Click()
Process_CheckBox CheckBox2
End SubPrivate Sub CheckBox3_Click()
Process_CheckBox CheckBox3
End SubPrivate Sub CheckBox4_Click()
Process_CheckBox CheckBox4
End SubPrivate Sub CheckBox5_Click()
Process_CheckBox CheckBox5
End SubPrivate Sub CheckBox6_Click()
Process_CheckBox CheckBox6
End SubPrivate Sub CheckBox7_Click()
Process_CheckBox CheckBox7
End Sub
