Solved hyperlink button excel

August 1, 2011 at 01:51:04
Specs: Windows Vista
Could some kind person please tell me what code I would have to write for a button to take me to a sheet entitled "anothersheet" within the same workbook.

Thank you, Ian Malik


See More: hyperlink button excel

Report •


#1
August 1, 2011 at 03:29:33
✔ Best Answer
Sub MyCode()
  Sheets("anothersheet").Activate
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
August 1, 2011 at 04:22:57
Thank you so much DerbyDad...

This is what I now have:

Private Sub CommandButton1_Click()
Sub MyCode()
Sheets("anothersheet").Activate
End Sub

But when I click on the button it returns a message:

"Compile error: Expected End Sub"

What to do now please?

Ian Malik


Report •

#3
August 1, 2011 at 05:39:47
What to do now please?

Ian Malik


Report •

Related Solutions

#4
August 1, 2011 at 05:56:11
You can not have 2 lines that "start" a subroutine.

Private Sub CommandButton1_Click()
   Sub MyCode()

Drop the Sub MyCode() line and see what happens.

2 other comments:

1 - Before posting any more code, please click on the blue line at the end of this post and read the instructions on the use of the 'pre' tags.

2 - In the future, please do not select a Best Answer until you are sure that the solution fits your needs.

Once you select a Best Answer, the thread is marked as [Solved]. As you can see from this situation, your issue is not yet [Solved].

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#5
August 1, 2011 at 06:19:29
Thank you,

All the hyperlink buttons perform perfectly now in design view, but not at all if I go back to the 'home' tab. Why is that?

Ian Malik


Report •

#6
August 1, 2011 at 07:14:33
I don't know and I don't have Excel 2007 on this machine so I can't test anything.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#7
August 1, 2011 at 18:00:08
OK, not to worry Derbydad, I appreciate what you have taught me so far, thank you for your kind assistance...

Ian Malik


Report •


Ask Question