I’ve made a vba macro to collect BoE data.
As part of my macro I have a button that removes a row of data from one sheet, alongside an entire other sheet.
Dim btn As button
Dim btnName As String
Dim actionStr As String
btnName = buttonText & "_" & sheetName ' Use sheet name for unique identifier
Set btn = ws.Buttons.Add(ws.Cells(buttonRow, buttonColumn).Left, ws.Cells(buttonRow, buttonColumn).Top, ws.Cells(buttonRow, buttonColumn).Width, ws.Cells(buttonRow, buttonColumn).Height)
With btn
.OnAction = "'" & buttonMacro & " """ & sheetName & """'"
.Caption = buttonText
.Name = btnName
This was all working perfectly fine yesterday, but today when trying to run it I get the following error:
error message
I have literally no idea what could be causing this error at this point, and would appreciate any advice – thanks!
I’ve tried every possible way of writing the .OnAction line with literally no success – leading me to think the issue might lie elsewhere. Just strange given it was working yesterday
Adam Brookes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.