Prevent clicking on a cell
Hi,
So is there any way make the
Range("B5:C5") unselectable?
No but you can stop them staying there.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B5:C5")) Is Nothing Then
MsgBox "Hey you out of there!!!"
Target.Offset(1).Select
End If
End Sub
--
Mike
When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
"ordnance1" wrote:
I want to run the code below to prevent a range of cells from being selected
if the Range("Q7") = 1. I have all cells on the worksheet locked but the
user must be able to click on the locked cells to trigger a userform so I
have to check Select Locked Cells. So is there any way make the
Range("B5:C5") unselectable?
If Range("Q7") = 1 Then
Range("B5:C5").Locked = True
End If
.
|