I have a working Excel sheet in Excel 2010 on Windows 10 which is failing on my client's side on Excel 2011 for Mac because of the "argument not optional" error when they click on the button. Additionally, it isn't working on their end on a different computer running Office 365. It seems to be highlighting Characters in the 6th line of code:
Sub Rectangle4_Click()
Dim xSelShp As Shape, xSelLst As Variant, I As Integer
Set xSelShp = ActiveSheet.Shapes(Application.Caller)
Set xLstBox = ActiveSheet.ListBox4
If xLstBox.Visible = False Then
xLstBox.Visible = True
xSelShp.TextFrame2.TextRange.Characters.Text = "SAVE"
Else
xLstBox.Visible = False
xSelShp.TextFrame2.TextRange.Characters.Text = "SELECT"
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("R4") = Mid(xSelLst, 1, Len(xSelLst) - 1)
Else
Range("R4") = ""
End If
End If
End Sub
The ListBox it is showing/hiding is an ActiveX ListBox.
I doubt it's relevant, but there are 40 of these Rectangle buttons in the sheet, all with near identical code, just switching 4 references.
Can anyone see what I'm missing here? Or know anything about cross-platform issues with code like this?
Thank you.