perbrethil
perbrethil

Reputation: 131

Make variable hyperlink from cell data

Hi I am kind of new to VBA and i can't seem to find what i am looking for.

What i want to make is a macro that links to another page in my workbook that refers to data in a certain cell. from certain datapoints i have a cell set up that as everything is filled in it gives the name of the page i want to link to (lets say "overview_Oct_2020" by filling in the month and year in other cells), and when running the macro go to that.

I seem to totally blank on how to do it. I made a =HYPERLINK() version pretty easily, but i want to change that to a button, hence the reason for a macro.

so technically i want to make a button with a macro that goes to [TEXT IN CEL A1]!A1

Upvotes: 0

Views: 66

Answers (1)

horst
horst

Reputation: 713

Put this macro in a standard module and assign it to a button on the worksheet

Sub link()

    Dim textInCelA1 as String
    textInCelA1 = Range("A1").value

    Sheets(textInCelA1).Activate
    Range("A1").Select

End Sub

Upvotes: 1

Related Questions