sassriverrat
Well-known Member
- Joined
- Oct 4, 2018
- Messages
- 655
I have a workbook that seems to cause errors with other workbooks. It seems random but usually the error is 9- subscript out of range
Ideas on this? Here's an example of code that kicked when I opened another workbook
Ideas on this? Here's an example of code that kicked when I opened another workbook
Code:
Function PrevSheet(RCell As Range)
'Begins Error Handling Code
On Error GoTo Helper
Dim xIndex As Long
Application.Volatile
xIndex = RCell.Worksheet.Index
If xIndex > 1 Then
PrevSheet = Worksheets(xIndex - 1).Range(RCell.Address)
End If
'Error Clearing Code
Exit Function
Helper:
resp = MsgBox("We're sorry to see you've encountered an error." & vbCrLf & vbCrLf & "To proceed, we recommend you contact the Developer " & _
"with error codes [1141] and " & "[" & Err.Number & "-" & Err.Description & "]." & vbCrLf & vbCrLf & "To attempt to patch your problem at least " & _
"temporarily, we recommend you click [Yes] to see help directions. Would you like to continue?", vbYesNoCancel, name)
If resp = vbYes Then
UserForm18.Show
'MsgBox ("Success")
ElseIf resp = vbNo Then
Exit Function
ElseIf resp = vbCancel Then
Exit Function
End If
End Function