Runtime error -214702024809 (80070057) only after protecting sheet

Blasirl

New Member
Joined
Aug 7, 2013
Messages
16
Office Version
  1. 2021
Platform
  1. Windows
I am in the process of trying to create an input spreadsheet that will eventually be used to output a form for each user on a forum. For the most part I used dropdowns to allow for most selections. My issue at the moment is when I protect the worksheets, I get a runtime error -214702024809 (80070057), but if I unprotect it, it works fine (up to the limits of my Excel skills so far).

I think it has something to do with the ListBox ActiveX Control I am using. I tried to unprotect the button I created a number of different ways but none seemed to work. I am using (and trying to understand) some borrowed VBA code to get the dropdown of list boxes to select from. It is attributed within the code. I am not a VBA programmer at all, but will learn bits and pieces if need be.

Any help would be appreciated.

The version of Excel I am using is pictured below.

The attached file is a macro-enabled Excel file that has been sheet protected. The password is: zx

Windows Build/VersionVersion 21H2 (OS Build 22000.1696) as of 27MAR2023

VBA Code:
Sub Rectangle1_Click()
'Updated by Extendoffice 20200730
Dim xSelShp As Shape, xSelLst As Variant, I, J As Integer
Dim xV As String
Set xSelShp = ActiveSheet.Shapes(Application.Caller)
Set xLstBox = ActiveSheet.ListBox1
If xLstBox.Visible = False Then
    xLstBox.Visible = True
    xSelShp.TextFrame2.TextRange.Characters.Text = "Pickup Options"
    xStr = ""
    xStr = Range("ListBoxOutput").Value
    
    If xStr <> "" Then
         xArr = Split(xStr, ";")
    For I = xLstBox.ListCount - 1 To 0 Step -1
        xV = xLstBox.List(I)
        For J = 0 To UBound(xArr)
            If xArr(J) = xV Then
              xLstBox.Selected(I) = True
              Exit For
            End If
        Next
    Next I
    End If
Else
    xLstBox.Visible = False
    xSelShp.TextFrame2.TextRange.Characters.Text = "Select Options"
    For I = xLstBox.ListCount - 1 To 0 Step -1
        If xLstBox.Selected(I) = True Then
        xSelLst = xLstBox.List(I) & ";" & xSelLst
        End If
    Next I
    If xSelLst <> "" Then
        Range("ListBoxOutput") = Mid(xSelLst, 1, Len(xSelLst) - 1)
    Else
        Range("ListBoxOutput") = ""
    End If
End If
End Sub

I have tried in vain to use xl2bb and so far am not able to.

1680106904707.png


This is what it looks like after i hit end

1680106992169.png

The spreadsheet is posted here if you wish to look at it. https://www.elevenforum.com/t/only-...ed-i-get-a-runtime-error-what-is-wrong.13736/
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I haven't tested out your code but have you tried unlocking the control? Go to the controls property and unlock it. Possibly the controls will work when the sheets are protected.

Or just keep the sheets unprotected.
 
Upvote 0
I will give that a try. Can you explain the process for that?
As for leaving them unprotected, this will eventually be a public page and since I do not know the final "face" of the page, if it stays like this, it would be to easy to inadvertently mess it up.
 
Upvote 0
This is what I see when I follow Microsoft's instructions:

1680184906325.png

1680184976930.png


Per what they say to do, my only choice to unlock the controls is to unprotect the spreadsheet which in turn defeats my goal.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,217
Members
452,619
Latest member
Shiv1198

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