rjplante
Well-known Member
- Joined
- Oct 31, 2008
- Messages
- 569
- Office Version
- 365
- Platform
- Windows
I have a macro (Macro A listed below) on a worksheet page VBA code window. Macro A will work in conjunction with conditional formatting and a defined Name which is a cell to capture the row I am on, to color the range of cells corresponding to the row I have selected. I also have a second macro (Macro B) in a module folder that turns on an autofilter and then filters based on a specific criteria. At the end of Macro A it turns on the protection of the sheet. Macro B unprotects the sheet at the beginning and then a range of data is selected. Because the range is selected MAcro A executes and then protects the sheet so that the rest of Macro B cannot run and I get an error that says I cannot turn on the autofilter with the page protected.
My question is this: How can I suspend the operation of Macro A during the execution of Macro B, and the rest of my macros for that matter?
Macro A in "Main Page" code window:
Thanks for the help,
Robert
My question is this: How can I suspend the operation of Macro A during the execution of Macro B, and the rest of my macros for that matter?
Macro A in "Main Page" code window:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Sheets("Main Page").Unprotect
Range("L8:L5008").ClearContents
Range("A8:K5008").Locked = True
'Return active row or column in named cells.
[SelRow] = ActiveCell.Row
Sheets("Main Page").Protect
Call EDIT_TEXT
End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Sub EDIT_TEXT()
If ActiveCell.Row > 7 And ActiveCell.Column < 13 Then
Range("L" & Range("AM2").Value).Value = "EDIT"
Else
Exit Sub
End If
End Sub
Thanks for the help,
Robert