Giordano Bruno
Well-known Member
- Joined
- Jan 7, 2007
- Messages
- 1,352
I have a Goal Seek macro which runs automatically when certain cells are changed. If the worksheet is unprotected and I change a cell, the code works as it should. The first line of the code in the Worksheet_Change macro unprotects the worksheet and the last line protects it with the code. ".Protect Password:=pwd, UserInterFaceOnly:=True. Having run the code once, and with the worksheet now protected, when I change a cell again, the code stops with the error message "Reference isn't valid". Effectively the code will only work if the worksheet is unprotected before I change the cell value. The same problems occurs even when every cell in the worksheet is unlocked. Does anyone know of a solution?