Results 1 to 21 of 21

Reset parts of worksheet automatically, but not others

Threaded View

  1. #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

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