Thread
:
Macro That doesn't work - Please help
View Single Post
#
4
Posted to microsoft.public.excel.programming
Don Guillett[_2_]
external usenet poster
Posts: 1,522
Macro That doesn't work - Please help
try this
Option Explicit
Sub chngelinkSAS()
Dim lastrow As Long
Dim i As Long
Dim MyCol As String
Dim MySht As String
On Error Resume Next
MyCol = InputBox("Enter column LETTER(S)")
MySht = InputBox("Enter sheet name")
Sheets(MySht).Select
lastrow = Sheets(MySht) _
..Cells(Cells.Rows.Count, MyCol).End(xlUp).Row
For i = 2 To lastrow
ActiveSheet.Hyperlinks.Add Anchor:=Cells(i, MyCol), _
Address:=Cells(i, MyCol).Hyperlinks(1).Address, _
TextToDisplay:="Tax Record"
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"JayLatimer" wrote in message
...
I have a macro which converts urls in a column to the words "Tax Record"
but
the macro will not work. When I run the Macro it prompts for Column and
then
prompts for sheet name as expected. When valid inputis given to both
questions the Macro ends without error but does not convert the urls in
the
column identified into the words "Tax Record"
I would appreicate any help I can get. The Marco is:
Sub chngelink()
'
' chngelink Macro
'
' Keyboard Shortcut: Ctrl+z
Dim MyCol As String
Dim MySht As String
On Error Resume Next
MyCol = InputBox("Enter column LETTER(S)")
MySht = InputBox("Enter sheet name")
Lastrow = Sheets(MySht).Cells(Cells.Rows.Count, MyCol).End(xlUp).Row
For Each c In Sheets(MySht).Range(MyCol & "2:" & MyCol & Lastrow)
c.Hyperlinks(1).TextToDisplay = "Tax record"
Next
End Sub
Reply With Quote
Don Guillett[_2_]
View Public Profile
Find all posts by Don Guillett[_2_]