Hi everyone,
Please can someone help me with the following, apologies if this is quite basic. I've not done any VBA for a long time and I'm out of practice.
In my Excel workbook I have a number of buttons to take you to different sheets in the model, I'm trying to write code that can be assigned to all buttons that pulls through from a range so I can easily update it in future.
I'm getting a run time 13 error, when I hover over sheetname, it is pulling through the right range, so I'm a bit confused as to what is causing this.
Thanks in advance.
Please can someone help me with the following, apologies if this is quite basic. I've not done any VBA for a long time and I'm out of practice.
In my Excel workbook I have a number of buttons to take you to different sheets in the model, I'm trying to write code that can be assigned to all buttons that pulls through from a range so I can easily update it in future.
Code:
Sub Sheet_Tab()
Dim sheetname As Range
Sheets("Controls").Range("SelectedSheet") = ActiveSheet.Shapes(Application.Caller).TextFrame.Characters.Text
Set sheetname = Sheets("Controls").Range("SheetTabName")
Sheets(sheetname).Select
End Sub
I'm getting a run time 13 error, when I hover over sheetname, it is pulling through the right range, so I'm a bit confused as to what is causing this.
Thanks in advance.