Worksheet with Multiple Worksheet Changes

roccoau

New Member
Joined
Dec 25, 2016
Messages
22
Office Version
  1. 365
Hi
I have a worksheet which I would like to add 3 different change requests as per below
I get below message so I gather this may not be possible
Does anyone have any tips on how to get around this.
I am only new to Excel code so help much appreciated

Thanks
Rocco
1616105365458.png


CODE
----------------------------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim v As Variant

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Range("C16:C29")) Is Nothing Then Exit Sub 'specific range

'Turn off events to keep out of loops
Application.EnableEvents = False

v = Application.Match(Target.Value, Worksheets("Lists").Range("B:B"), False)

If Not IsError(v) Then
Target.Value = Worksheets("Lists").Range("A:A").Cells(v).Value
End If

'Turn events back on to get ready for the next change
Application.EnableEvents = True
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim v As Variant

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Range("G16:G29")) Is Nothing Then Exit Sub 'specific range

'Turn off events to keep out of loops
Application.EnableEvents = False

v = Application.Match(Target.Value, Worksheets("Lists").Range("F:F"), False)

If Not IsError(v) Then
Target.Value = Worksheets("Lists").Range("E:E").Cells(v).Value
End If

'Turn events back on to get ready for the next change
Application.EnableEvents = True
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim v As Variant

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Range("H16:H29")) Is Nothing Then Exit Sub 'specific range

'Turn off events to keep out of loops
Application.EnableEvents = False

v = Application.Match(Target.Value, Worksheets("Lists").Range("I:I"), False)

If Not IsError(v) Then
Target.Value = Worksheets("Lists").Range("H:H").Cells(v).Value
End If

'Turn events back on to get ready for the next change
Application.EnableEvents = True
End Sub
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
You can only have one per worksheet. This should do it:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim v As Variant

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Range("C16:C29,G16:G29,H16:H29")) Is Nothing Then Exit Sub 'specific range

'Turn off events to keep out of loops
Application.EnableEvents = False

Select Case Target.Column
    Case 3
        v = Application.Match(Target.Value, Worksheets("Lists").Range("B:B"), False)
        If Not IsError(v) Then Target.Value = Worksheets("Lists").Range("A:A").Cells(v).Value
    Case 7
        v = Application.Match(Target.Value, Worksheets("Lists").Range("F:F"), False)
        If Not IsError(v) Then Target.Value = Worksheets("Lists").Range("E:E").Cells(v).Value
    Case 8
        v = Application.Match(Target.Value, Worksheets("Lists").Range("I:I"), False)
        If Not IsError(v) Then Target.Value = Worksheets("Lists").Range("H:H").Cells(v).Value
End Select

'Turn events back on to get ready for the next change
Application.EnableEvents = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,791
Messages
6,121,611
Members
449,038
Latest member
apwr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top