McM_
New Member
- Joined
- Oct 23, 2023
- Messages
- 23
- Office Version
- 365
- Platform
- Windows
Hi,
with this code I block the row if something is written in A.
For example, A3="AAA", the row "B3:M3" is blocked for editing.
Please help me with the modification of the code so that I can block the row "B3:M3" but also the other rows down from B3:M3.
If A9>"", then block B9:M9 down.
If A20>"", then block B20:M20 down, and so on.
Thank you very much!
with this code I block the row if something is written in A.
For example, A3="AAA", the row "B3:M3" is blocked for editing.
Please help me with the modification of the code so that I can block the row "B3:M3" but also the other rows down from B3:M3.
If A9>"", then block B9:M9 down.
If A20>"", then block B20:M20 down, and so on.
Thank you very much!
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B:M")) Is Nothing Then
If UCase(Cells(Target.Row, "A")) > "" Then
Application.EnableEvents = False
MsgBox " blocked for editing !!!"
Cells(Target.Row, "E").Select
Application.EnableEvents = True
End If
End If
End Sub
lock.xlsm | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | |||
1 | ||||||||||||||||
2 | ||||||||||||||||
3 | AAA | |||||||||||||||
4 | ||||||||||||||||
5 | ||||||||||||||||
6 | ||||||||||||||||
7 | ||||||||||||||||
8 | ||||||||||||||||
9 | ||||||||||||||||
10 | ||||||||||||||||
11 | ||||||||||||||||
12 | ||||||||||||||||
13 | ||||||||||||||||
14 | ||||||||||||||||
15 | ||||||||||||||||
16 | ||||||||||||||||
17 | ||||||||||||||||
18 | ||||||||||||||||
19 | ||||||||||||||||
20 | ||||||||||||||||
21 | ||||||||||||||||
22 | ||||||||||||||||
23 | ||||||||||||||||
24 | ||||||||||||||||
25 | ||||||||||||||||
26 | ||||||||||||||||
27 | ||||||||||||||||
28 | ||||||||||||||||
29 | ||||||||||||||||
30 | ||||||||||||||||
Foaie1 |