S
sharpie23
This is on Sheet 6
Option Explicit
Private Sub Worsksheet_Change(ByVal Target As Range)
Call Missing
End Sub
This is in the Module
Sub Missing()
Dim StudentID
Dim StudentRow As Integer
Dim StudentRange As Range
StudentID = Worksheets(6).Range("C7").Value
On Error GoTo JFK
StudentRow = Application.WorksheetFunction.Match(StudentID,
Worksheets(2).Range("C:C"), 0)
Set StudentRange = Worksheets(2).Cells(StudentRow, 4)
Set StudentRange = StudentRange.Resize(1, 60)
'StudentRange.CurrentRegion.Columns.Count - 1)
Application.EnableEvents = False
Worksheets(6).Range("A11:A500").ClearContents
Application.EnableEvents = True
s = 11
For Each c In StudentRange.Cells
If c = 0 Then
Application.EnableEvents = False
Worksheets(6).Cells(s, 1) = c.Offset(5 - StudentRow,
0).Value
s = s + 1
Application.EnableEvents = True
End If
Next
Exit Sub
JFK:
Application.EnableEvents = False
Worksheets(6).Range("A11:A500").ClearContents
Worksheets(6).Cells(11, 1) = "Wrong ID Number"
Application.EnableEvents = True
End Sub
No matter What I do to the Sheet it will not fire the code. I can get
it to start by assinging it a button to push on the main page, but
otherwise it will not work.
Any ideas?
Option Explicit
Private Sub Worsksheet_Change(ByVal Target As Range)
Call Missing
End Sub
This is in the Module
Sub Missing()
Dim StudentID
Dim StudentRow As Integer
Dim StudentRange As Range
StudentID = Worksheets(6).Range("C7").Value
On Error GoTo JFK
StudentRow = Application.WorksheetFunction.Match(StudentID,
Worksheets(2).Range("C:C"), 0)
Set StudentRange = Worksheets(2).Cells(StudentRow, 4)
Set StudentRange = StudentRange.Resize(1, 60)
'StudentRange.CurrentRegion.Columns.Count - 1)
Application.EnableEvents = False
Worksheets(6).Range("A11:A500").ClearContents
Application.EnableEvents = True
s = 11
For Each c In StudentRange.Cells
If c = 0 Then
Application.EnableEvents = False
Worksheets(6).Cells(s, 1) = c.Offset(5 - StudentRow,
0).Value
s = s + 1
Application.EnableEvents = True
End If
Next
Exit Sub
JFK:
Application.EnableEvents = False
Worksheets(6).Range("A11:A500").ClearContents
Worksheets(6).Cells(11, 1) = "Wrong ID Number"
Application.EnableEvents = True
End Sub
No matter What I do to the Sheet it will not fire the code. I can get
it to start by assinging it a button to push on the main page, but
otherwise it will not work.
Any ideas?