stir-crazy
New Member
- Joined
- Dec 28, 2005
- Messages
- 29
I'm trying to have a check box in each cell of a column that when checked will insert todays date; I found a nice example of how to do that here:
Sub Process_CheckBox()
Dim cBox As CheckBox
Dim LRow As Integer
Dim LRange As String
LName = Application.Caller
Set cBox = ActiveSheet.CheckBoxes(LName)
'Find row that checkbox resides in
LRow = cBox.TopLeftCell.Row
LRange = "B" & CStr(LRow)
'Change date in column B, if checkbox is checked
If cBox.Value > 0 Then
ActiveSheet.Range(LRange).Value = Date
'Clear date in column B, if checkbox is unchecked
Else
ActiveSheet.Range(LRange).Value = Null
End If
End Sub
From: http://techonthenet.com/excel/macros/checkbox.php
However, I'm adding this checkbox to an existing spreadsheet, and the rows vary in height (Autofit). When added to the shorter rows, the checkboxes overlap with the row beneath; moving the checkbox up slightly, however, causes the associated macro to link to the cell above the one I want it to! Arrrrr!
I searched, but can't seem to find a way to ensure that the rows are of a certain minimum height, but possibly greater due to Autofit.
Ideas?
Thanks!
Sub Process_CheckBox()
Dim cBox As CheckBox
Dim LRow As Integer
Dim LRange As String
LName = Application.Caller
Set cBox = ActiveSheet.CheckBoxes(LName)
'Find row that checkbox resides in
LRow = cBox.TopLeftCell.Row
LRange = "B" & CStr(LRow)
'Change date in column B, if checkbox is checked
If cBox.Value > 0 Then
ActiveSheet.Range(LRange).Value = Date
'Clear date in column B, if checkbox is unchecked
Else
ActiveSheet.Range(LRange).Value = Null
End If
End Sub
From: http://techonthenet.com/excel/macros/checkbox.php
However, I'm adding this checkbox to an existing spreadsheet, and the rows vary in height (Autofit). When added to the shorter rows, the checkboxes overlap with the row beneath; moving the checkbox up slightly, however, causes the associated macro to link to the cell above the one I want it to! Arrrrr!
I searched, but can't seem to find a way to ensure that the rows are of a certain minimum height, but possibly greater due to Autofit.
Ideas?
Thanks!