G
Guest
I have question regarding "if", "IsError" and a specific error message "REF",
because it does not execute correctly:
For example this is my function button:
***************************
Private Sub btnSaveNext_Click()
Dim EReturnValue As Boolean
EReturnValue = IsError(Hoja(jCopy).Cells(xCopy, yCopy).Formula)
If EReturnValue Then
MsgBox "Not able to update the cell, error will occur, check values again"
Else
Hoja(jCopy).Cells(xCopy, yCopy).Formula = TxtNCellValue.Value
btnSaveNext.Enabled = False
btnCopyCellFromCurrent.Enabled = False
End If
End Sub
***************************
I already checked the value of:
Hoja(jCopy).Cells(xCopy, yCopy).Formula
And it is:
=Sheet2!C288+#REF!C288
With other kind of values not including "#REF!" the function works fine
I know that "#REF!" is and ERROR and I want to "SKIP it" with a Message Box:
"Not able to update the cell, error will occur, check values again"
But it does not go to this message
Instead of that, it crash the macro (showing me in a yellow line after
"Else" )
Also, it shows this error message:
******************************
Microsoft Visual Basic
Run-time error '1004';
Application-defined or object-defined error
******************************
Thanks for your help
Coco
because it does not execute correctly:
For example this is my function button:
***************************
Private Sub btnSaveNext_Click()
Dim EReturnValue As Boolean
EReturnValue = IsError(Hoja(jCopy).Cells(xCopy, yCopy).Formula)
If EReturnValue Then
MsgBox "Not able to update the cell, error will occur, check values again"
Else
Hoja(jCopy).Cells(xCopy, yCopy).Formula = TxtNCellValue.Value
btnSaveNext.Enabled = False
btnCopyCellFromCurrent.Enabled = False
End If
End Sub
***************************
I already checked the value of:
Hoja(jCopy).Cells(xCopy, yCopy).Formula
And it is:
=Sheet2!C288+#REF!C288
With other kind of values not including "#REF!" the function works fine
I know that "#REF!" is and ERROR and I want to "SKIP it" with a Message Box:
"Not able to update the cell, error will occur, check values again"
But it does not go to this message
Instead of that, it crash the macro (showing me in a yellow line after
"Else" )
Also, it shows this error message:
******************************
Microsoft Visual Basic
Run-time error '1004';
Application-defined or object-defined error
******************************
Thanks for your help
Coco