Public Sub LockCells()
Dim Cell As Range
Worksheets("SUDOKU").Unprotect
Dim Answer As Integer
Answer = MsgBox("This Lock Button has been designed to lock the numbers you have copied from a Solveable Puzzle." & vbCrLf & vbCrLf & "Have you already copied them over?" & vbCrLf & vbCrLf & "Select Yes to proceed or No to cancel and add those numbers. Only lock after you have your solvealbe numbers entered & verified", vbYesNo + vbQuestion, "Lock Numbers")
If Answer = vbYes Then
For Each Cell In Worksheets("SUDOKU").Range("B2:J10")
Cell.Locked = Cell.Value <> ""
Cell.Font.Bold = Cell.Value <> ""
Next Cell
Worksheets("SUDOKU").Protect
End If
End Sub
Sub ClearPuzzle()
Dim Answer As Integer
Answer = MsgBox("You have chosen to CLEAR the entire puzzle." & vbCrLf & vbCrLf & "This will return all BOLD nbrs back to UnBold" & vbCrLf & vbCrLf & "Is this what you want to do?", vbYesNo + vbQuestion, "Clear Puzzle?")
If Answer = vbYes Then
With Sheets("SUDOKU")
.Unprotect
With .Range("B2:J10")
.Locked = False
.ClearContents
.Font.Bold = False
End With
End With
End If
End Sub
Bookmarks