ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Date with Check Box (https://www.excelbanter.com/excel-programming/389125-insert-date-check-box.html)

ToddEZ

Insert Date with Check Box
 
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

ToddEZ

Insert Date with Check Box
 
....I guess I should also add that I have more than 50 checkboxes in this
worksheet.

"ToddEZ" wrote:

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


Dave Peterson

Insert Date with Check Box
 
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.

ToddEZ wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 02:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com