Hello,
I have this VBA code running in cell A1 which gives you a yes/no message box when you try to change the selected cell. I am trying to have the Target.Address = 'Specific Header Cell in Table' but I am not able to develop the code to do so. Here is the code:
The main reason I have this message box is to prevent the user from changing the cell in the table because the titles in the tables are linked to macros. If they are changed, the macros will not run. Also, I am aware there are codenames for the excel sheets in a workbook. If there are codenames for the header titles in an excel table, I could link my macros to the codenames. As a result, I would not need this macro for the message box.![]()
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then Application.EnableEvents = False sMsg = "Are you sure you want to change this value?" response = MsgBox(sMsg, vbYesNo) If response <> vbYes Then Application.Undo Application.EnableEvents = True Else Application.EnableEvents = True Exit Sub End If End If End Sub
Any help with this would be greatly appreciated.
Bookmarks