"This array is fixed or temporarily locked" error in VBA

General Ledger

Active Member
Joined
Dec 31, 2007
Messages
460
Dear All,

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
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
What line does it actually bug out on? Have you provided this line? Can you include the code for the labels Done1 and Done2?
 
Upvote 0
That code doesn't error for me. Have you tried shutting down Excel (maybe rebooting too) and seeing if it still errors?
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,749
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top