I have this workbook with about ever increasing worksheets. At the present moment it stand at 50 worksheets and counting. On every worksheet is a worksheet selection change event routine that I am trying to trim the size by having some of the codes transfer or alter into a module sheet. That is to say each worksheet will use a call routine to execute the change event. Below is the original codes in the worksheet.
Once again appreciate any help I can get.
Once again appreciate any help I can get.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim frmUF As UserForm1
Dim frmUF2 As UserForm2
Dim frmUF3 As UserForm3
Dim frmUF4 As UserForm4
Dim lRowEnd As Long
Dim sDataRange As String
If Not Intersect(Target, Range("$K$4:$N$4")) Is Nothing Then
Set frmUF = New UserForm1
With frmUF
.SelectionDataList = "Menu!Risk_Likelihood2"
.Show
If .SelectedValue <> "" Then Target.Value = .SelectedValue
End With
ElseIf Not Intersect(Target, Range("$K$5:$N$5")) Is Nothing Then
Set frmUF2 = New UserForm2
With frmUF2
.SelectionDataList = "Menu!Risk_Impact2"
.Show
If .SelectedValue <> "" Then Target.Value = .SelectedValue
End With
ElseIf Not Intersect(Target, Range("$G$6:$I$6")) Is Nothing Then
Set frmUF3 = New UserForm3
With frmUF3
.SelectionDataList = "Menu!Action_Status"
.Show
If .SelectedValue <> "" Then Target.Value = .SelectedValue
End With
ElseIf Not Intersect(Target, Range("$I$12:$N$12")) Is Nothing Then
Set frmUF4 = New UserForm4
With frmUF4
.SelectionDataList = "Menu!Risk_Response"
.Show
If .SelectedValue <> "" Then Target.Value = .SelectedValue
End With
End If
End Sub