R
rob nobel
The part code (following), seems to work OK, but only if I click the green
tick by the formula bar, as when I press enter, or select another cell to
exit the cell where I've entered an X, it doesn't work.
I realise that this is because the active cell is no longer the one where I
typed an X but I don't know how to get this procedure to do this.
What I've tried to do (in an awkward way) is....
1. Type an X into Column N and make all the cells (in that row) in columns
G:N and P:R, locked.
2. Make those cells unlocked if the x is deleted.
3. What I'd also like is to have the procedure work whether it is an upper
or lowercase x.
Can someone please help with this?
Furthermore, is it possible to have separate Worksheet_Change events for
different procedures on the same sheet as I'm trying to do quite a number of
things on the same sheet and it all becomes rather confusing doing it all
under the one Worksheet_Change event. ( I am also using a
Worksheet_SelectionChange event on this sheet.)
Rob
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Target, Me.Range("N26:N1525")) Is Nothing Then GoTo
NextTest Else GoTo BalCol
'Some other code here
BalCol:
If ActiveCell = "X" Then
With ActiveCell
.Offset(0, -7).Resize(1, 7).Locked = True
.Offset(0, 2).Resize(1, 3).Locked = True
End With
End If
If ActiveCell = "" Then
With ActiveCell
.Offset(0, -7).Resize(1, 7).Locked = False
.Offset(0, 2).Resize(1, 3).Locked = False
End With
End If
End Sub
tick by the formula bar, as when I press enter, or select another cell to
exit the cell where I've entered an X, it doesn't work.
I realise that this is because the active cell is no longer the one where I
typed an X but I don't know how to get this procedure to do this.
What I've tried to do (in an awkward way) is....
1. Type an X into Column N and make all the cells (in that row) in columns
G:N and P:R, locked.
2. Make those cells unlocked if the x is deleted.
3. What I'd also like is to have the procedure work whether it is an upper
or lowercase x.
Can someone please help with this?
Furthermore, is it possible to have separate Worksheet_Change events for
different procedures on the same sheet as I'm trying to do quite a number of
things on the same sheet and it all becomes rather confusing doing it all
under the one Worksheet_Change event. ( I am also using a
Worksheet_SelectionChange event on this sheet.)
Rob
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Target, Me.Range("N26:N1525")) Is Nothing Then GoTo
NextTest Else GoTo BalCol
'Some other code here
BalCol:
If ActiveCell = "X" Then
With ActiveCell
.Offset(0, -7).Resize(1, 7).Locked = True
.Offset(0, 2).Resize(1, 3).Locked = True
End With
End If
If ActiveCell = "" Then
With ActiveCell
.Offset(0, -7).Resize(1, 7).Locked = False
.Offset(0, 2).Resize(1, 3).Locked = False
End With
End If
End Sub