Proulxs
New Member
- Joined
- Mar 4, 2022
- Messages
- 26
- Office Version
- 2021
- 2019
- 2016
- 2013
- Platform
- Windows
Hi,
I have a file with several scripts running in which users enter various code using barcodes and for the most part it work fine but the code reader sometimes write random stuff. I added a check to discard that stuff but there's an issue when it write something that excel cannot accept like =dada
In that exemple Excel will accept what's written and simply display in the cell that it doesn't know what function it is, but then my script try to load the value and error 13 will appear. I'm trying to capture this error to reset and clear the cell. But On error Goto Retry fail to stop the error from being written on screen.
Here's the first few lines of script:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Errror GoTo Retry
If ActiveWorkbook.Name = "horodateur.xlsm" Then
If Target.Offset(-1, 0).Value = "QUITEXCEL" Then
When the error pop in it'll show on screen and debug send me to the 4th line because it tried to read the value of the cell.
The questions:
1.1) Why this error isn't captured.
1.2) Is there a way to put the on error somewhere else that would trigger? I assume no since it is this script that do cause the error (this is in sheet1 object)
2) Also is there a simple way to discard mathematical error too? Like if it type +1..1 that would cause excel to ask to confirm the formula?
I have a file with several scripts running in which users enter various code using barcodes and for the most part it work fine but the code reader sometimes write random stuff. I added a check to discard that stuff but there's an issue when it write something that excel cannot accept like =dada
In that exemple Excel will accept what's written and simply display in the cell that it doesn't know what function it is, but then my script try to load the value and error 13 will appear. I'm trying to capture this error to reset and clear the cell. But On error Goto Retry fail to stop the error from being written on screen.
Here's the first few lines of script:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Errror GoTo Retry
If ActiveWorkbook.Name = "horodateur.xlsm" Then
If Target.Offset(-1, 0).Value = "QUITEXCEL" Then
When the error pop in it'll show on screen and debug send me to the 4th line because it tried to read the value of the cell.
The questions:
1.1) Why this error isn't captured.
1.2) Is there a way to put the on error somewhere else that would trigger? I assume no since it is this script that do cause the error (this is in sheet1 object)
2) Also is there a simple way to discard mathematical error too? Like if it type +1..1 that would cause excel to ask to confirm the formula?