Hello,
I'm trying to call a Sub which I created in a module into a worksheet. The idea is to create multiple modules which I can call in this worksheet where the module is applying on. This are the codes I use right now.
Module 1
Worksheet
When I use the code which I placed in the module directly in the worksheet, the code is working. But I have to create multiple lines for other values like Lift and Vide, which was not working in the worksheet. So I want to create Modules for those values and run them on the worksheet.
Can someone help me with this problem?
Kind regards,
Sue Ellen
I'm trying to call a Sub which I created in a module into a worksheet. The idea is to create multiple modules which I can call in this worksheet where the module is applying on. This are the codes I use right now.
Module 1
VBA Code:
Private Sub Trap()
If Intersect(Range("C31"), Target) Is Nothing Then Exit Sub
If Target.Value = "Nee" Then
Sheets("AB-BV-BF").Rows(46).Interior.ColorIndex = 16
Sheets("AB-BV-BF").Rows(65).Interior.ColorIndex = 16
Sheets("AB-BV-BF").Rows(66).Interior.ColorIndex = 16
Sheets("AB-BV-BF").Rows(67).Interior.ColorIndex = 16
End If
If Target.Value = "Ja" Then
Sheets("AB-BV-BF").Rows(46).Interior.ColorIndex = xlNone
Sheets("AB-BV-BF").Rows(65).Interior.ColorIndex = xlNone
Sheets("AB-BV-BF").Rows(66).Interior.ColorIndex = xlNone
Sheets("AB-BV-BF").Rows(67).Interior.ColorIndex = xlNone
End If
End Sub
Worksheet
VBA Code:
Private Sub Worksheet_Activate()
Application.Run ("Module1.Trap")
End Sub
When I use the code which I placed in the module directly in the worksheet, the code is working. But I have to create multiple lines for other values like Lift and Vide, which was not working in the worksheet. So I want to create Modules for those values and run them on the worksheet.
Can someone help me with this problem?
Kind regards,
Sue Ellen
Last edited by a moderator: