Arcadian Myth
New Member
- Joined
- Apr 1, 2022
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hello all,
I'm new to this forum, but I feel like this is a great place to get help. I am trying to find the correct If Then coding to use that will pop up a message box if there is no inverse to a matrix, but everything I have tried has failed. The closest I have gotten to something that works is the following:
If Solution = True Then
Selection.Copy
Sheets("Solution").Select
Sheets("Solution").Range("B5").Resize(rowsize:=nRowA, columnsize:=nColA).Select
Selection.FormulaArray = "=MINVERSE(Amat)"
Selection.Font.Bold = True
Application.CutCopyMode = False
Else
strMessage = "Matrix does not have an Inverse"
MsgBox strMessage
Sheets("Solution").Select
Selection.ClearContents
End If
But this prompts the message box whether there is an answer or not. I spent a few hours on google trying to find a solution, and that's how I got here. Please help me understand how to do this. I was thinking using the fact that an inverse that does not exist gives a calculation error of #NUM! and somehow integrating that into the If Then statement, but I don't know the commands, or how to even start that. Please help.
I'm new to this forum, but I feel like this is a great place to get help. I am trying to find the correct If Then coding to use that will pop up a message box if there is no inverse to a matrix, but everything I have tried has failed. The closest I have gotten to something that works is the following:
If Solution = True Then
Selection.Copy
Sheets("Solution").Select
Sheets("Solution").Range("B5").Resize(rowsize:=nRowA, columnsize:=nColA).Select
Selection.FormulaArray = "=MINVERSE(Amat)"
Selection.Font.Bold = True
Application.CutCopyMode = False
Else
strMessage = "Matrix does not have an Inverse"
MsgBox strMessage
Sheets("Solution").Select
Selection.ClearContents
End If
But this prompts the message box whether there is an answer or not. I spent a few hours on google trying to find a solution, and that's how I got here. Please help me understand how to do this. I was thinking using the fact that an inverse that does not exist gives a calculation error of #NUM! and somehow integrating that into the If Then statement, but I don't know the commands, or how to even start that. Please help.