tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,832
- Office Version
- 365
- 2019
- Platform
- Windows
I am seeking an alternative to:
because as I understand, that only reverses the last action performed by a user, as opposed by the VBA code.
So my idea is to make use of these two events:
Using Worksheet_SelectionChange ensures the value on a CLICKED cell is captured, so if the user enters a value on a cell that for some reason is not permitted, I can reverse the change by applying the Worksheet_SelectionChange event.
However, all of the above only works IF the user actively CLICKS on a cell.
If instead they click on cell A1, then presses delete, Excel automatically activates cell A2 (although this feature can be change using:
and since the active cell is now A2, the Worksheet_SelectionChange would NOT be triggered.
So far, I have added:
to force users to click back onto column A to make any changes.
Is there a better solution?
Thanks
Code:
Application.Undo
because as I understand, that only reverses the last action performed by a user, as opposed by the VBA code.
So my idea is to make use of these two events:
Code:
Worksheet_SelectionChange
and
Worksheet_Change
Using Worksheet_SelectionChange ensures the value on a CLICKED cell is captured, so if the user enters a value on a cell that for some reason is not permitted, I can reverse the change by applying the Worksheet_SelectionChange event.
However, all of the above only works IF the user actively CLICKS on a cell.
If instead they click on cell A1, then presses delete, Excel automatically activates cell A2 (although this feature can be change using:
Code:
Application.MoveAfterReturn = False
and since the active cell is now A2, the Worksheet_SelectionChange would NOT be triggered.
So far, I have added:
Code:
Application.MoveAfterReturnDirection = xlToRight
to force users to click back onto column A to make any changes.
Is there a better solution?
Thanks