General Ledger
Active Member
- Joined
- Dec 31, 2007
- Messages
- 460
Dear All,
What is the solution for the error-
I have code that checks if necessary data is on the active worksheet. If not, a message is displayed that gives the user the option to exit the macro or move to the next sheet in the file:
I get the error after the test fails and the user selects to continue the macro after moving to the next sheet.
It seems when this code is run on the next sheet, the Array is still "locked" from the prior loop.
Is there a way to reset the Array so it is not locked?
Best regards,
GL
What is the solution for the error-
Code:
Run-time error '10':
This array is fixed or temporarily locked
I have code that checks if necessary data is on the active worksheet. If not, a message is displayed that gives the user the option to exit the macro or move to the next sheet in the file:
Code:
For Each Word In Array("CUSTOMER:", "PO No:", "B/L:")
Set aRange = Range("a1:iv100").Find(What:=Word, _
LookAt:=xlWhole, MatchCase:=False)
If aRange Is Nothing Then
msg = "All required fields are not present" & vbCrLf & vbCrLf
msg = msg & "on the sheet: " & ActiveSheet.NAME & vbCrLf & vbCrLf
msg = msg & Word & " is missing." & vbCrLf & vbCrLf
msg = msg & "Continue macro on next sheet?"
If MsgBox(msg, 4, " Attention:") = vbYes Then
GoTo DONE:
Else
GoTo DONE2:
End If
End If
Next Word
I get the error after the test fails and the user selects to continue the macro after moving to the next sheet.
It seems when this code is run on the next sheet, the Array is still "locked" from the prior loop.
Is there a way to reset the Array so it is not locked?
Best regards,
GL