Consulting

Results 1 to 6 of 6

Thread: Solved: Checkbox issue

  1. #1
    VBAX Regular
    Joined
    Mar 2008
    Location
    Texas
    Posts
    19
    Location

    Question Solved: Checkbox issue

    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)

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Totally guessing without seeing the data or the workbook, but maybe, just maybe

    [vba]

    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
    [/vba]

    But I wouldn't use activeX controls, I would use formatted ticks, see code above, as they are simpler to count.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Mar 2008
    Location
    Texas
    Posts
    19
    Location

    Question

    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.

  4. #4
    VBAX Regular
    Joined
    Mar 2005
    Location
    Helena, MT
    Posts
    90
    Location
    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

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try this. You just select a row wwhere the chcekboxes were to tick, select again to untick it.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Regular
    Joined
    Mar 2008
    Location
    Texas
    Posts
    19
    Location
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •