Results 1 to 1 of 1

Need help coding Lookup Statements

Threaded View

ZooTV92 Need help coding Lookup... 05-01-2012, 11:01 AM
  1. #1
    Forum Contributor
    Join Date
    01-30-2011
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    102

    Need help coding Lookup Statements

    Sample Worksheet.xlsxSample Worksheet.xlsxSample workbook attached.

    I am currently using this code, thanks to the help of this board to check against scheduling the same employee in a shift. I have tried in vain to utilize this template to further code the rest of the workbook.

    'Private Sub Worksheet_Change(ByVal Target As Range)
    
    check for duplicate shifts (Friday)
        Dim myrange As Range
        Set myrange = Range("L8:L187")
        If Not Intersect(Target, myrange) Is Nothing Then
            Application.EnableEvents = False
            If WorksheetFunction.CountIf(myrange, Target) > 1 Then
                MsgBox "This employee has already been scheduled during the matinee shift.", vbExclamation + vbOKOnly, "Duplicate Shift"
                ActiveCell.Select
                Selection.ClearContents
                
            End If
            GoTo exit_sub
        End If
    
    Set myrange = Range("AB8:AH187")
        If Not Intersect(Target, myrange) Is Nothing Then
            Application.EnableEvents = False
            If WorksheetFunction.CountIf(myrange, Target) > 1 Then
                MsgBox "This employee has already been scheduled during the evening shift.", vbExclamation + vbOKOnly, "Duplicate Shift"
                ActiveCell.Select
                Selection.ClearContents
            End If
            
        End If
    exit_sub:
        Application.EnableEvents = True
    
    End Sub
    Explanations of what I am after included in the very basic attached workbook.

    Any help is greatly appreciated.
    Last edited by ZooTV92; 05-01-2012 at 11:06 AM.

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