View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Checkboxes from the Forms Toolbar

right click on the checkbox and select assign a macro.

You should an assign it a macro like

Sub EnterDate()
if Activesheet.Checkboxes("Check Box 1").Value = xlOn then
Range("A1").Value = Date
Range("A1").NumberFormat = "MM/DD/YYYY"
end if
End Sub

If you want checking any of the three checkboxes to fill the cells, assign
them all to a single macro that does that

Sub EnterData()
Dim cbox as Checkbox
set cbox = Activesheet.Checkboxes(Application.Caller)
if cbox = xlOn then
Range("A1").Value = Format(Date,"mm/dd/yyyy")
Range("A2").Value = Format(Time,"hh:mm AM/PM")
Range("A3").Value = "HP"
end if
End Sub

You haven't said how one would tell whether the Commandbutton had been click
previously.

--
Regards,
Tom Ogilvy

"cht13er" wrote in message
...
I looked through the Google Groups posts and the Microsoft Office

Discussion
posts, but I just cannot seem to find what I am looking for.

What I would like to do is have a few checkboxes on the main page of my
file: "Date", "Time", "Company". If the user checks any or all of these

boxes
before clicking the CommandButton "Go on", some VBA code will fill in

cells
a1, a2, and a3 with the date, time, and company name (say "HP"). If some

of
the checkmarks on the first sheet are NOT checked, the code will leave the
corresponding cells on the second sheet blank.

Thanks for your response!
cht13er