I have a Module on a worksheet that when I click on a checkbox it puts the date into the cell directly to the right of the checkbox. Works great... I now want that Module in a new workbook.
I export the module to my desktop (Module1.bas)
Copy a checkbox
Close the workbook
Open the new workbook
Paste the checkbox
Import the module
Right click on the checkbox and Assign the Macro from THIS workbook.
Now when I click it I get a compile error... "Compile Error - Can't find project or library" - the debugger is open and Sub Process_Checkbox() is highlighted in yellow and LNAME is grey... What did I miss? I must be tired...
My code is here:
Sub Process_CheckBox()
Dim cBox As CheckBox
Dim LCol As Long
Dim LRow As Long
Dim Rng As Range
LName = Application.Caller
Set cBox = ActiveSheet.CheckBoxes(LName)
'Find row that checkbox resides in
LCol = cBox.TopLeftCell.Column
LRow = cBox.TopLeftCell.Row
Set Rng = ActiveSheet.Cells(LRow + 1, LCol + 1)
'Change date in cell to the right of CheckBox, if checkbox is checked
If cBox.Value > 0 Then
Rng.Value = Date
'Clear date in column B, if checkbox is unchecked
Else
Rng.ClearContents
End If
End Sub
Bookmarks