Good morning! I am attempting to run multiple subs on the same sheet to automate my workbook. Is there a way to create a reference sheet for each module, like the way you do for CSS and HTML? I'm extremely new to this language of code. My subs work independently, just not when I make them modules.
The main piece of code I'm working with:
Public Sub Worksheet_Change(MasterModule)
Call Module2
Call Module1
End Sub
Module1:
Public Sub Worksheet_Change(ByVal Target As Range)
Dim Cchanged As Range, c As Range
Const myVal As String = "FP" '<-- Change to suit
Set Cchanged = Intersect(Target, Columns("A"))
If Not Cchanged Is Nothing Then
Application.EnableEvents = False
For Each c In Cchanged
If UCase(c.Value) = UCase(myVal) Then
c.Offset(, 1).Value = myVal
Else
c.Offset(, 1).ClearContents
End If
Next c
Application.EnableEvents = True
End If
End Sub
Module2:
Public Sub Worksheet_Change(ByVal Target As Range)
Dim Cchanged As Range, c As Range
Const myVal As String = "GTSD" '<-- Change to suit
Set Cchanged = Intersect(Target, Columns("C"))
If Not Cchanged Is Nothing Then
Application.EnableEvents = False
For Each c In Cchanged
If UCase(c.Value) = UCase(myVal) Then
c.Offset(, 1).Value = "N/A"
Else
c.Offset(, 1).ClearContents
End If
Next c
Application.EnableEvents = True
End If
End Sub
Moved from Office / Excel / Windows 10 / Office 2010