Insert Date with Check Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to create a macro that would enter todays date (hard coded) on
the date that a checkbox was checked. The cell would be offset by two
columns in the same row as the checkbox. Please advise.

Thanks
 
....I guess I should also add that I have more than 50 checkboxes in this
worksheet.
 
Add a checkbox from the Forms toolbar and assign this macro to it.

Option Explicit
Sub TestMe()
dim myCBX as Checkbox
set myCBX = activesheet.checkboxes(application.caller)

mycbx.topleftcell.offset(0,2).value = date
end sub

or maybe:

Option Explicit
Sub TestMe()
dim myCBX as Checkbox
set myCBX = activesheet.checkboxes(application.caller)

if mycbx.value = xlon then
mycbx.topleftcell.offset(0,2).value = date
else
mycbx.topleftcell.offset(0,2).value = ""
end if
end sub

Change the name (TestMe) to something that makes more sense to you.

And then copy this checkbox 49 times.

The assigned macro will "travel" with the copied checkbox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top