ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   HYPERLINKS IN VBA!! (https://www.excelbanter.com/excel-discussion-misc-queries/148059-hyperlinks-vba.html)

Elise148

HYPERLINKS IN VBA!!
 
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

Gary''s Student

HYPERLINKS IN VBA!!
 
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

--
Gary''s Student - gsnu200733


"Elise148" wrote:

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


Elise148

HYPERLINKS IN VBA!!
 
Is there anything I can do to keep the !A1 from showing up after I run the
macro?


"Gary''s Student" wrote:

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

--
Gary''s Student - gsnu200733


"Elise148" wrote:

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


Elise148

HYPERLINKS IN VBA!!
 
Nevermind. I got it! Thanks for your help!!!

"Gary''s Student" wrote:

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

--
Gary''s Student - gsnu200733


"Elise148" wrote:

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



All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com