Date Stamp on Checkbox

prooney653

New Member
Joined
Dec 8, 2016
Messages
2
I have inherited a spreadsheet which I am trying to get working again. I have a few basic Macro skills however I cannot get this one to work.
I have a spreadsheet that has checkboxes, and would like to put a timestamp in the checkboxes when they checked. Checkboxes are in the upper right hand corner of the cell and timestamp should be in the bottom of the cell.

I am getting a error that Macros are disabled or not available in this workbook. However I know they are and I have it saved as an macro enables workbook.

When I step into the code, I see I am getting an application.caller error=2023. I have researched and cannot find how to fix.

Please let me know if you have any suggestions on how to fix. Below is the macro

Sub CheckBox_Date_Stamp()
Dim cbx As CheckBox

'Application.Caller returns the name of the CheckBox that called this macro
Set cbx = ActiveSheet.CheckBoxes(Application.Caller)

'.TopLeftCell returns the cell address located at the top left corner of the cbx checkbox
With cbx.TopLeftCell.Offset(0, 0)

'Check the checkbox status (checked or unchecked)
If cbx.Value = xlOn Then
' Checkbox is Checked
.Value = Date
Else
' Checkbox is unchecked
.Value = ""
End If
End With

End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
welcome to the board

So your file is saved correctly as a .xlsm file?

And when you open it, you aren't in Protected view, and you've enabled macros?

You say step in, do you mean using F8? Or from changing the check box? i.e. How are you starting to run this macro?
 
Upvote 0
File is saved correctly as .xlsm,
I am enabling macros when I open the file as well as I went into trust center settings and updated to allow all macros to run
When I say step in, I just mean opening up the VBA code.
Macro should run whenever you check a box. It should datestamp the same box in the bottom of the box whenever it is checked.

Thanks,
 
Upvote 0
OK, and are these all ActiveX check boxes or basic check boxes with macros attached? And you're getting this error as soon as you open the VB Editor?

The error reminds me of issues encountered with ActiveX controls, but your code looks like you're using basic form controls. I wonder if you have other [no longer used] ActiveX controls elsewhere..?

Difference between ActiveX and basic form controls:
to select a basic control, right click and it becomes selectable like an image, dots appear at corners and on edges. This doesn't happen with ActiveX controls
to select ActiveX control, go to Excel > Developer tab > design mode. You can now left click on the object. Double-clicking it jumps to VB Editor and code is created that relates to the control
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,568
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top