+ Reply to Thread
Results 1 to 21 of 21

Reset parts of worksheet automatically, but not others

Hybrid View

  1. #1
    Registered User
    Join Date
    10-30-2008
    Location
    CA
    Posts
    62

    Reset parts of worksheet automatically, but not others

    First, ignore the colored portions. This is how I kept track of what I had completed in the form as I created it. Clients attend class once a week and would be marked present on the corresponding day of class. This increases column #3 "classes attended" to "1". What I would like is for my individual classes sheet to reset every Monday (as the date of the report on top) but for the "5groups" worksheet to keep count of the classes attended. Does that make sense? Please, any imput would REALLY be appreciated.
    Attached Files Attached Files
    Last edited by MDCK; 12-15-2008 at 05:54 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello MDCK,

    This was not as difficult as I first thought. What I did was create five named ranges "Monday0930am", "Monday0100pm", "Tuesday0600pm", "Thursday0600pm", and "Saturday0100am". Each range encompasses all the columns and row in the block for that day. The CheckBoxes on each worksheet call the same macro. The macro takes two arguments: the name of named range to search for Client in, and the name of the CheckBox. The attached workbook contains all these changes and has been tested.
    Sub UpdateClassCount(ByVal Rng_Name As String, ByVal ChkBox_Name As String)
    
      Dim ChkBox As Object
      Dim ClassCount As Range
      Dim R As Long
      Dim Rng As Range
        
        Set Rng = Range(Rng_Name)
        Set ChkBox = ActiveSheet.OLEObjects(ChkBox_Name)
        R = ChkBox.TopLeftCell.Row
        Client = Cells(R, 1)
        
          Set ClassCount = Rng.Find(What:=Client, _
                                    LookIn:=xlValues, _
                                    LookAt:=xlWhole, _
                                    SearchOrder:=xlByRows, _
                                    SearchDirection:=xlNext, _
                                    MatchCase:=False)
          If ClassCount Is Nothing Then Exit Sub
          
          If ClassCount > 0 Then
            C = ClassCount.Offset(0, 2).Value
              If ChkBox.Object = True Then
                C = C + 1
              Else
                C = C - 1
              End If
            ClassCount.Offset(0, 2) = C
          End If
           
    End Sub
    Sincerely,
    Leith Ross
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-30-2008
    Location
    CA
    Posts
    62
    Thank you very much. I have encountered a couple of problems when I tested it. On the Monday930 sheet, when I checked the box for Client2, I received an error message stating "Compile error: Argument not optional" and highlighted was the section "Private Sub CheckBox2_Click()". When I went back to my 5groups sheet, the classes attended number did not increase for this client. I place check marks in all of the other boxes and none increased as they did before. When I changed my system date to a week ahead, closed the program and reopened it (to get the new report date) my individual classes did not reset the boxes to be unchecked. I really wish I understood macros so I wouldn't have to pester others with my projects. In my original sheet, when the boxes were checked the classes attended increased, but I couln't figure out how to get those "attendance sheets" to reset so I can use them again next week. With us being a non-profit organization, we lack the funds to hire someone to do this for us, therefore leaving me awake until 2am trying to figure this out and eventually asking you guys for help when I just can't do it. Did you encounter these issues?
    Last edited by MDCK; 12-02-2008 at 02:48 PM. Reason: added text

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello MDCK,

    The last change I made didn't save properly. It has been fixed.

    Sincerely,
    Leith Ross
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-30-2008
    Location
    CA
    Posts
    62
    I tried it again and now I am not receiving the error message. When I change the system date and reopen the file, my attendance sheets are not reseting to being unchecked and if I uncheck them manually, it removes it from the classes attended tally. Any input will and has been greatly appreciated.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello MDCK,

    I set the macro to either add or subtract 1 from the class attendance count. If he box is checked the count is incremented by 1, and if unchecked decrement by 1, unless the attendance is zero. I missed the part about the date originally. What is supposed to happen with the date change?

    Sincerely,
    Leith Ross

  7. #7
    Registered User
    Join Date
    10-30-2008
    Location
    CA
    Posts
    62
    I had the sheet to already add 1 to the classes attended when the box was checked. What I wish the form would do is "Every Monday all attendance sheets reset to unchecked, and on the 5 groups sheet the number of classes remains" meaning that I can go back one month and see that one client attended 3 classes so far and that another attended 4. That way, I can see how many classes they have left. Like I said, my original sheet can already add +1 to the classes attended column, I just need that number to "stick" and the attendance sheets to reset to all boxes unchecked so that my instructors can mark who is present for that weeks class. The date of reset is the date reflected on the top, which I have set to be "every Monday". I hope I am doing better at explaining myself. What do you think? Can this be done?

  8. #8
    Registered User
    Join Date
    10-30-2008
    Location
    CA
    Posts
    62
    I just noticed that it works ONLY where "Client" is typed. How can I make all the boxes act the same? Meaning I will have listed about 13 to 14 different names per class. I only listed those right now because I was doing counts and such.

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello MDCK,

    Please post your current workbook, and I will review it and make the needed changes.

    Sincerely,
    Leith Ross

  10. #10
    Registered User
    Join Date
    10-30-2008
    Location
    CA
    Posts
    62
    I used the same one you worked on and posted for me. All I did was add a name where it was blank.

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello MDCK,

    I will use the version I posted previously and make the needed changes to that one.

    Sincerely,
    Leith Ross

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello MDCK,

    I am a little confused by what you want. A few posts back you talk about the number of classes being tracked...
    What I wish the form would do is "Every Monday all attendance sheets reset to unchecked, and on the 5 groups sheet the number of classes remains" meaning that I can go back one month and see that one client attended 3 classes so far and that another attended 4. That way, I can see how many classes they have left.
    You changed the "5 Groups" sheet to track classes attended and classes remaining. Can you clarify what I should do?

    Sincerely,
    Leith Ross

  13. #13
    Registered User
    Join Date
    10-30-2008
    Location
    CA
    Posts
    62
    Ok I found the issue. It works perfectly. The problem was that a name is required for the check box addition to work! I'm having trouble figuring out the resetting. I keep changing my system date to mimic what would happen and I can't get it to reset. I'm still trying though. If I can't get it to work, can I just use reset button without messing up your work? What I ultimately wish is that the attendance sheet checkboxes clear so I can use them again next week. I think (please correct me if I'm wrong) that the easiest way is for a simple 'reset' button on each attendance sheet that the intructor would click on at the beginning of next weeks class. Am I making sense?
    Last edited by MDCK; 12-10-2008 at 03:50 PM.

  14. #14
    Registered User
    Join Date
    10-30-2008
    Location
    CA
    Posts
    62

    Talking

    Ok I did it!!!! I'm so proud of myself. I added a reset button to the form that clears the checkboxes and it doesn't mess with my totals. Here it is for you to look at to make sure I didn't mess with your macros. My only concern is that I don't know how to change your macro so that the line that indicates a reset does not occur on Monday anymore. Please let me know what I need to do to mark this solved. Thank you so very much.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1