Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Rebecca
 
Posts: n/a
Default Simple Hyperlink Macro

Hi. I am using MS Excel 2003, and I am very new to the program. I don't know
how to use visual basic or programming of any kind. I need help with a
macro, and I'm hoping this is the best place to ask for help.

I have a worksheet entitled "NT." In column "A" I have a very long list of
vocabulary words (not alphabetized). For reasons I won't bother you with, I
want to establish hyperlinks for each of these words (column A) in another
worksheet entitled "LINKS" (also in column A). Thus, when I click on the
hyperlink for a word in LINKS, I will be taken to the hyperlink in NT.

I tried several times to make a macro but failed. I couldn't for the life
of me get the macro to change panes or windows (Control F6 and so on). Could
someone please help me with this macro? I would deeply appreciate your help.
Also, how can I set up a hot key so I don't have to run the macro one by one
through the entire column A in NT. In other words, could the macro be run
once and all hyperlinks be inserted in LINKS, instead of run laboriously word
by word?

  #2   Report Post  
Kirchberger
 
Posts: n/a
Default

Hi Rebecca,

Try this and see if it does what you want to create the links.

I assume that both sheets are in the same workbook, and that there are
no blank cells in your word list. This macro will stop as soon as it
encounters an empty cell in the column.

You need to put this code into a module. Press Alt+F11 to open the
Visual Basic Editor and find your workbook's project. Right-click on it
and select Insert Module. Now enter this macro in the module's code
window (to the right):

Sub CreateLinks()
' select the first name cell before running
Dim sCellAddress As String
Dim sFormulaPrefix As String
Dim SLinkFormula As String

sFormulaPrefix = "=Hyperlink(""[" & _
ActiveWorkbook.FullName & "]" & _
ActiveSheet.Name & "!"

While Not IsEmpty(ActiveCell.Value)
sCellAddress = ActiveCell.Address
SLinkFormula = sFormulaPrefix & _
sCellAddress & """,""" & _
CStr(ActiveCell.Value) & """)"
Worksheets("Links").Activate
Range(sCellAddress).Formula = SLinkFormula
Worksheets("NT").Activate
ActiveCell.Offset(1, 0).Select
Wend
End Sub

Return to Excel (Alt+F11), select the first word in the NT sheet, and
run the macro (Tools Macro Macros...).

This should build your hyperlinks using the same words as in the NT
sheet, and in the corresponding cells. It's not anything fancy or
general purpose, just a straightforward approach to do what you
described (as I understood it :-).

I hope that it works for you,

Gary
[DropContiguousDigitsTwoThruFiveForDirect]

  #3   Report Post  
GaryDK
 
Posts: n/a
Default

Hi Rebecca,

Try this and see if it does what you want to create the links.

I assume that both sheets are in the same workbook, and that there are
no blank cells in your word list. This macro will stop as soon as it
encounters an empty cell in the column.

You need to put this code into a module. Press Alt+F11 to open the
Visual Basic Editor and find your workbook's project. Right-click on it
and select Insert Module. Now enter this macro in the module's code
window (to the right):

Sub CreateLinks()
' select the first name cell before running
Dim sCellAddress As String
Dim sFormulaPrefix As String
Dim SLinkFormula As String

sFormulaPrefix = "=Hyperlink(""[" & _
ActiveWorkbook.FullName & "]" & _
ActiveSheet.Name & "!"

While Not IsEmpty(ActiveCell.Value)
sCellAddress = ActiveCell.Address
SLinkFormula = sFormulaPrefix & _
sCellAddress & """,""" & _
CStr(ActiveCell.Value) & """)"
Worksheets("Links").Activate
Range(sCellAddress).Formula = SLinkFormula
Worksheets("NT").Activate
ActiveCell.Offset(1, 0).Select
Wend
End Sub

Return to Excel (Alt+F11), select the first word in the NT sheet, and
run the macro (Tools Macro Macros...).

This should build your hyperlinks using the same words as in the NT
sheet, and in the corresponding cells. It's not anything fancy or
general purpose, just a straightforward approach to do what you
described (as I understood it :-).

I hope that it works for you,

Gary
[DropContiguousDigitsTwoThruFiveForDirect]

  #4   Report Post  
Rebecca
 
Posts: n/a
Default

Thanks, Gary, it worked perfectly.

"GaryDK" wrote:

Hi Rebecca,

Try this and see if it does what you want to create the links.

I assume that both sheets are in the same workbook, and that there are
no blank cells in your word list. This macro will stop as soon as it
encounters an empty cell in the column.

You need to put this code into a module. Press Alt+F11 to open the
Visual Basic Editor and find your workbook's project. Right-click on it
and select Insert Module. Now enter this macro in the module's code
window (to the right):

Sub CreateLinks()
' select the first name cell before running
Dim sCellAddress As String
Dim sFormulaPrefix As String
Dim SLinkFormula As String

sFormulaPrefix = "=Hyperlink(""[" & _
ActiveWorkbook.FullName & "]" & _
ActiveSheet.Name & "!"

While Not IsEmpty(ActiveCell.Value)
sCellAddress = ActiveCell.Address
SLinkFormula = sFormulaPrefix & _
sCellAddress & """,""" & _
CStr(ActiveCell.Value) & """)"
Worksheets("Links").Activate
Range(sCellAddress).Formula = SLinkFormula
Worksheets("NT").Activate
ActiveCell.Offset(1, 0).Select
Wend
End Sub

Return to Excel (Alt+F11), select the first word in the NT sheet, and
run the macro (Tools Macro Macros...).

This should build your hyperlinks using the same words as in the NT
sheet, and in the corresponding cells. It's not anything fancy or
general purpose, just a straightforward approach to do what you
described (as I understood it :-).

I hope that it works for you,

Gary
[DropContiguousDigitsTwoThruFiveForDirect]


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
New Excel user needs help with simple Macro... Rahim Kassam New Users to Excel 1 January 24th 05 02:10 PM
Can't get simple macro to run Abi Excel Worksheet Functions 5 January 12th 05 07:37 PM
Assigning a Hyperlink to a Macro Paul Excel Discussion (Misc queries) 3 December 16th 04 05:34 PM


All times are GMT +1. The time now is 07:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"