PDA

View Full Version : Solved: Checkbox issue



canselmi
03-30-2008, 10:16 PM
I have 7 worksheets (daily timesheets) that allow an employee to fill out hourly time. I have 17 rows and at the end of each row there is a checkbox that the employee can check if they have to take off from work and come back later. We call this split time.

I have an 8th worksheet that is the timesheet summary. I need one cell on this summary worksheet to indicate (maybe a check mark) if one or more of the checkboxes are checked for that day. This will let accounting know to look at that days timesheet instead of the summary page.

I think I might need an array, but I have no experience with an array.

I've started with the following code, but got nowhere:

Private Sub Boxeschecked ()

If sheet1.checkbox1 & sheet1.checkbox2 & sheet1.checkbox3 & sheet1.checkbox4... = true

then Activesheet.range (A1) = (I'm lost here)

Bob Phillips
03-31-2008, 01:29 AM
Totally guessing without seeing the data or the workbook, but maybe, just maybe



If Sheet1.CheckBox1 Or Sheet1.CheckBox2 Or Sheet1.CheckBox3 Or Sheet1.CheckBox4 Then
ActiveSheet.Range("A1").Value = "a"
ActiveSheet.Range("A1").Font.Name = "Marlett"
End If


But I wouldn't use activeX controls, I would use formatted ticks, see code above, as they are simpler to count.

canselmi
04-01-2008, 01:44 PM
XLD, Thanks for the help. This is the code I was looking for; and it works but only if the code is run in VBA. Also if I clear a checkbox, the summary page still shows the check mark even after running the code again.

Is there a way to force the code to automatically update if a checkbox is checked or unchecked. Please see attachment.

lenze
04-01-2008, 01:52 PM
Not really sure where you want to go with this, but this might be useful.
http://vbaexpress.com/kb/getarticle.php?kb_id=879

lenze

Bob Phillips
04-01-2008, 04:05 PM
Try this. You just select a row wwhere the chcekboxes were to tick, select again to untick it.

canselmi
04-01-2008, 09:50 PM
XLD,

Special thanks to you for taking the time to look at my project. This solution will work great. I am humbled and learning along the way. Please don't give up on us.