Hello
As so many others in here i'm a rookie at VBA trying to make some nice QOL improvements at my new job.
Hence i tried to add a button that would extend a small table (not formatted as table though) and keep the formatting and formulas. And I actually succeded (atleast a little bit) and the button works as intended. Therefore it was a surprise to me, that when i run the code in the VBA editor, it gives me "run-time error '-2147352571 (80020005)'"
As you can probably understand i do not like this, and would like to solve it before shipping the spreadsheet out to the intended users.
My code is as follows:
And the table looks like this. The object used as trigger is just an icon inserted from the excel-icons.
here's a pic of the debug result:
I really can't seem to figure out, what the problem is.
Please help me
Thanks in advance
As so many others in here i'm a rookie at VBA trying to make some nice QOL improvements at my new job.
Hence i tried to add a button that would extend a small table (not formatted as table though) and keep the formatting and formulas. And I actually succeded (atleast a little bit) and the button works as intended. Therefore it was a surprise to me, that when i run the code in the VBA editor, it gives me "run-time error '-2147352571 (80020005)'"
As you can probably understand i do not like this, and would like to solve it before shipping the spreadsheet out to the intended users.
My code is as follows:
VBA Code:
Sub Tilføj_række_Hovedark()
Dim b As Object, cs As Integer
Set b = ActiveSheet.Shapes(Application.Caller)
With b.TopLeftCell.EntireRow.Offset(-2, 0)
.Insert
.Cells(1, 2).Copy .Cells(0, 2)
.Cells(1, 3).Copy .Cells(0, 3)
.Cells(1, 4).Copy .Cells(0, 4)
End With
End Sub
And the table looks like this. The object used as trigger is just an icon inserted from the excel-icons.
here's a pic of the debug result:
I really can't seem to figure out, what the problem is.
Please help me
Thanks in advance