HYPERLINKS IN VBA!!

G

Guest

This is what I want to do...I want to be able to create a hyperlink in a
macro AND, the most important part (because I already have successfully
created a hyperlink in a macro), RE-LINK the hyperlink to the copied and
renamed worksheet.

My code is below, it's real basic, but it's all I have so far. I'd REALLY
appreciate any help you guys could give me...thanks...

Elise


Sub Macro1()
'
Sheets("Sheet1").Select
n = Sheets.Count
Sheets("Sheet1").Copy After:=Sheets(n)
ActiveSheet.Name = InputBox("Enter the number of the new distributor.")

Sheets("Sheet1").Select
Range("A11").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=InputBox("Enter
the number of the new distributor.")
'
End Sub
 
G

Guest

Actually you were very, very, close. Just a little tweak:

Sub Macro1()
Sheets("Sheet1").Select
n = Sheets.Count
Sheets("Sheet1").Copy After:=Sheets(n)
ActiveSheet.Name = InputBox("Enter the number of the new distributor.")
v = ActiveSheet.Name & "!A1"
Sheets("Sheet1").Select
Range("A11").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
v, TextToDisplay:=v
End Sub
 
G

Guest

Nevermind. I got it! Thanks for your help!!!

Gary''s Student said:
Actually you were very, very, close. Just a little tweak:

Sub Macro1()
Sheets("Sheet1").Select
n = Sheets.Count
Sheets("Sheet1").Copy After:=Sheets(n)
ActiveSheet.Name = InputBox("Enter the number of the new distributor.")
v = ActiveSheet.Name & "!A1"
Sheets("Sheet1").Select
Range("A11").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
v, TextToDisplay:=v
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top