Excelquestion35
Board Regular
- Joined
- Nov 29, 2021
- Messages
- 53
- Office Version
- 2016
- Platform
- Windows
Hi all,
Currently I have an issue with the sequence on which my functions are performed. I had to update a document with a lot of modules already predefined. I had to insert a new function that empties the drop down list fields every time a new parent is chosen. However, this code only works if a macro is run before.
How can I make sure that the code works everytime without having to first perform a Macro from the modules?
This is the code that I wrote in the corresponding sheet:
Currently I have an issue with the sequence on which my functions are performed. I had to update a document with a lot of modules already predefined. I had to insert a new function that empties the drop down list fields every time a new parent is chosen. However, this code only works if a macro is run before.
How can I make sure that the code works everytime without having to first perform a Macro from the modules?
This is the code that I wrote in the corresponding sheet:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$14" Then
Range("B15").Value = " "
End If
If Target.Address = "$B$14" Then
Range("B25").Value = " "
End If
If Target.Address = "$B$15" Then
Range("B25").Value = " "
End If
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Application.Sheets("Sheet1").Range("B11", "B14", "B15", "B17", "B21", "B25", "B40", "B41", "B42", "B43", "B45").Value = "" Then
Cancel = True
MsgBox "Save cancelled"
End If
End Sub