C
Casey
Hi.
I have a Worksheet Change routine that doesn't do anything when the
Target range is changed. When I run the any of the lines of code after
the Else statement in the Immediate Window, it produces a 424 error
Object required. I'm just not seeing/understanding the problem. Need
some help please
Here is the code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, res As String
Dim wks1 As Worksheet, wks2 As Worksheet, wks3 As Worksheet
Set wks1 = Worksheets("Status Log")
Set wks2 = Worksheets("Setup Sheet")
Set wks3 = ActiveSheet
Set rng = wks1.Range("SVDBStatusLog") 'multiple column database
If Target.Address = "$D$1" Then
res = Application.VLookup(Target, rng, 1, False)
If IsError(res) Then
wks3.Range("D26").Value = "Not in Database, " & _
"manual entry required"
Else
wks3.Range("D2").Value = Application.VLookup(Target, _
rng, 4, False)
wks3.Range("D3").Value = Application.VLookup(Target, _
rng, 5, False)
wks3.Range("D4").Value = wks2.Range("Job_Name")
wks3.Range("D5").Value = Application.VLookup(Target, _
rng, 11, False)
wks3.Range("D6").Value = Application.VLookup(Target, _
rng, 11, False)
End If
End If
End Sub
I have a Worksheet Change routine that doesn't do anything when the
Target range is changed. When I run the any of the lines of code after
the Else statement in the Immediate Window, it produces a 424 error
Object required. I'm just not seeing/understanding the problem. Need
some help please
Here is the code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, res As String
Dim wks1 As Worksheet, wks2 As Worksheet, wks3 As Worksheet
Set wks1 = Worksheets("Status Log")
Set wks2 = Worksheets("Setup Sheet")
Set wks3 = ActiveSheet
Set rng = wks1.Range("SVDBStatusLog") 'multiple column database
If Target.Address = "$D$1" Then
res = Application.VLookup(Target, rng, 1, False)
If IsError(res) Then
wks3.Range("D26").Value = "Not in Database, " & _
"manual entry required"
Else
wks3.Range("D2").Value = Application.VLookup(Target, _
rng, 4, False)
wks3.Range("D3").Value = Application.VLookup(Target, _
rng, 5, False)
wks3.Range("D4").Value = wks2.Range("Job_Name")
wks3.Range("D5").Value = Application.VLookup(Target, _
rng, 11, False)
wks3.Range("D6").Value = Application.VLookup(Target, _
rng, 11, False)
End If
End If
End Sub