Is there a macro that will allow the user to work on a page ONLY after entering a value in a cell?
Is there a macro that will allow the user to work on a page ONLY after entering a value in a cell?
You could lock all the cells except the one you need input, and protect the sheet. Then use a Worksheet Change event to monitor that cell. When you get something input, you unprotect the sheet.
Protect the sheet again before you close/save the workbook.
Regards, TMS
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
Here is code that does what you're looking for, with the target cell in this case being B1. This needs to be an unlocked cell so the user can actually put something in it, while all the other cells in the spreadsheet should remained locked (the default). The code below also checks that the cell hasn't been changed to be empty, at which point it will relock the sheet.
Private Sub Worksheet_Activate() Sheet1.Protect "password" End Sub Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next If Target = Range("B1") Then If Not IsEmpty(Range("B1")) Then Sheet1.Unprotect "password" Else Sheet1.Protect "password" End If End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks