Macro toupdate hyper link

luvbite38

Active Member
Joined
Jun 25, 2008
Messages
368
Hi Guys,

I hope someone can help me out here.

Is there a way to make following two changes to hyperlinks

1- change the Text to Display to a numbers starting from 1 to onwards (1, 2, 3....n).
2- Also change the "Look in" option. This should be based on a cell value (Sheet1.cellA1.value). This cell contains the name of the folder.

I hope it makes sense?

Thanks in advance
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
The following should work:

Code:
Sub myTest()
    Dim i As Long
    Dim ws As Worksheet
    
    ' File or URL is in A1
    ' e.g. [url=http://www.google.com]Google[/url], C:\myfile.txt, [URL]file://C:\myfile.txt[/URL]
    ' Displayed name is: 99
    ' Hyperlink appears in B1
    
    i = 99
    Set ws = Sheet1
    ws.Range("B1").Formula = "=HYPERLINK(""" & ws.Range("A1") & """, " & i & ")"
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,181
Messages
6,129,355
Members
449,506
Latest member
nomvula

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top