Question [VSTO] how can i show messagebox when user edit locked cell.

j2kkjs2

Member
Joined
Jul 4, 2021
Messages
6
Programming Experience
5-10
I want to allow the user to input only certain cells in Excel and other cells will be locked. (example: .Cells[1,1])

I wrote the code as below, the problem is I want to show a specific message
when user input locked cell. (example: "You Can't Modify Item Cost")

What should I do?

cell lock:
            Excel.Worksheet ws_active = Globals.ThisAddIn.GetActiveSheet();
            
            ws_active.Cells.Locked = false;

            #region select cell for lock
            ws_active.Cells[1, 1].Locked = true;
            Globals.ThisAddIn.Application.DisplayAlerts = false;
            #endregion  select cell for lock
                
            ws_active.Protect();
 
Back
Top Bottom