I am getting an error when I use Application.Caller
in Excel VBA.
I have a piece of code attached to a button/shape that I want to use to print a timestamp in the cell next to the button.
I need to use this button over and over so don't want to reference actual ranges of where to put the timestamp, so I thought this code would work.
However, each time the macro gets to the 2nd line, i.e. the Application.Caller
row, it gives me an error:
ERROR 91 : 'Object variable or With block variable not set'
I would greatly appreciate if someone could assist with why this is happening as I can't fix it.
Thank you
I have tried activesheet.buttons
as well as activesheet.shapes
but neither have worked.
Dim x As Object
Set x = ActiveSheet.Shapes(Application.CALLER)
With x.TopLeftCell
Range(Cells(x.Row, x.Column), Cells(x.Row, x.Column)).Offset(0, 1).Select
End With