1 change event worked on the worksheet until it got too large. I split the 1 event into two events. One titled “Private Sub Worksheet_Change1(ByVal Target As Range)” which I want to work for changes in range E38:H70
The 2nd event “Private Sub Worksheet_Change(ByVal Target As Range)” is for changes in range E6:H37
The result was object variable or block variable not set errors. To resolve this I tried to set targets by either
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("E6:H37")) Is Nothing Then
Followed by code which worked prior to splitting into 2
AND
I also tried Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row >= 6 And Target.Row <= 37 Then
Followed by code which worked prior to splitting into 2
I have also tried to set target with If Not Application.Intersect(Target, Range("E6:H37")) Is Nothing Then
As a result now when changes are made E6:H37 the change event works. Changes within E38:H70 do not work, there are no error messages. Nothing happens
This is the start of each event:
The sub which is working:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("E6:H37")) Is Nothing Then
'Part1 cbdn
If Target.Address = "$E$6" Then
Select Case Target.Value
Case Is > 0
Application.Goto Reference:="cbdn_1"
Selection.EntireRow.Hidden = False
Application.Goto Reference:="T1_cbdn"
Case Is = ""
Application.Goto Reference:="cbdn_1"
Selection.EntireRow.Hidden = True
Application.Goto Reference:="T1_cbdn"
End Select
End If
Which continues on for many rows ending with
End If
End Sub
The event which is not working:
Private Sub Worksheet_Change1(ByVal Target As Range)
If Not Application.Intersect(Target, Range("E38:H70")) Is Nothing Then
'Part1 hah
If Target.Address = "$E$38" Then
Select Case Target.Value
Case Is > 0
Application.Goto Reference:="hah_1"
Selection.EntireRow.Hidden = False
Application.Goto Reference:="T1_hah"
Case Is = ""
Application.Goto Reference:="hah_1"
Selection.EntireRow.Hidden = True
Application.Goto Reference:="T1_hah"
End Select
End If
and so on ending with End If and End Sub
Any assistance would be much appreciated, thank you
The 2nd event “Private Sub Worksheet_Change(ByVal Target As Range)” is for changes in range E6:H37
The result was object variable or block variable not set errors. To resolve this I tried to set targets by either
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("E6:H37")) Is Nothing Then
Followed by code which worked prior to splitting into 2
AND
I also tried Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row >= 6 And Target.Row <= 37 Then
Followed by code which worked prior to splitting into 2
I have also tried to set target with If Not Application.Intersect(Target, Range("E6:H37")) Is Nothing Then
As a result now when changes are made E6:H37 the change event works. Changes within E38:H70 do not work, there are no error messages. Nothing happens
This is the start of each event:
The sub which is working:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("E6:H37")) Is Nothing Then
'Part1 cbdn
If Target.Address = "$E$6" Then
Select Case Target.Value
Case Is > 0
Application.Goto Reference:="cbdn_1"
Selection.EntireRow.Hidden = False
Application.Goto Reference:="T1_cbdn"
Case Is = ""
Application.Goto Reference:="cbdn_1"
Selection.EntireRow.Hidden = True
Application.Goto Reference:="T1_cbdn"
End Select
End If
Which continues on for many rows ending with
End If
End Sub
The event which is not working:
Private Sub Worksheet_Change1(ByVal Target As Range)
If Not Application.Intersect(Target, Range("E38:H70")) Is Nothing Then
'Part1 hah
If Target.Address = "$E$38" Then
Select Case Target.Value
Case Is > 0
Application.Goto Reference:="hah_1"
Selection.EntireRow.Hidden = False
Application.Goto Reference:="T1_hah"
Case Is = ""
Application.Goto Reference:="hah_1"
Selection.EntireRow.Hidden = True
Application.Goto Reference:="T1_hah"
End Select
End If
and so on ending with End If and End Sub
Any assistance would be much appreciated, thank you