McM_
New Member
- Joined
- Oct 23, 2023
- Messages
- 23
- Office Version
- 365
- Platform
- Windows
Hi,
is there a possibility of obtaining a VBA code that will block the rewriting of a cell after it has been completed?
In the attached table, I managed to keep the date and time locked. The text in cell E2 is a drop-down list, and column E will be filled when the cells in column B are filled. But once the cells in E are written, even if the text in E2 will change, what has been written so far should remain unchanged.
I simulated in E3:E7, with the reference "client 1" from E2, and if E2 changes to "client 2", the information from E3:E7 should remain unchanged, i.e. "client 1". It's a lot of text, but I hope I have understood what I need.
Thank you for help!
is there a possibility of obtaining a VBA code that will block the rewriting of a cell after it has been completed?
In the attached table, I managed to keep the date and time locked. The text in cell E2 is a drop-down list, and column E will be filled when the cells in column B are filled. But once the cells in E are written, even if the text in E2 will change, what has been written so far should remain unchanged.
I simulated in E3:E7, with the reference "client 1" from E2, and if E2 changes to "client 2", the information from E3:E7 should remain unchanged, i.e. "client 1". It's a lot of text, but I hope I have understood what I need.
Thank you for help!
Excel Formula:
VBA Code:
Private Sub worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then
Range("C" & Target.Row) = Date
Range("D" & Target.Row) = Time
'Range("E" & Target.Row) = ??
End If
End Sub
freeze cell.xlsm | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | ||||||||||||
2 | write something | block data | block time | client 2 | client 1 | |||||||
3 | 343 | 27.12.2023 | 14:33 | client 1 | client 2 | |||||||
4 | 556 | 27.12.2023 | 14:33 | client 1 | ||||||||
5 | 234 | 27.12.2023 | 14:33 | client 1 | ||||||||
6 | 443 | 27.12.2023 | 14:33 | client 1 | ||||||||
7 | 334 | 27.12.2023 | 14:33 | client 1 | ||||||||
8 | 332 | 27.12.2023 | 14:33 | client 2 | ||||||||
9 | ||||||||||||
10 | ||||||||||||
11 | ||||||||||||
12 | ||||||||||||
Sheet1 |
Cells with Data Validation | ||
---|---|---|
Cell | Allow | Criteria |
E2 | List | =$I$2:$I$3 |