Help with a short macro

B

bjbolton

Version: 2004
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

I need help with creating a short macro in Excel.
I need a quick macro to re-link an hyperlink approx 1500 email addresses and websites that don't have their linkage after importing them into Excel through a .CSV file.
Would any wizard out there be wiling to help or do it for me?
Right now I'm going down the columns one at a time and going ...
- COM+K (insert hyperlink dialog box)
- TAB (tab down to Display: <www.website.com>
- COM+C (copy)
- TAB
- TAB (tabs up to Link To: <field> )
- COM+V (paste)
- RETURN
....
I'd be very grateful for any assistance.
 
J

JE McGimpsey

Version: 2004
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

I need help with creating a short macro in Excel.
I need a quick macro to re-link an hyperlink approx 1500 email addresses and
websites that don't have their linkage after importing them into Excel
through a .CSV file.
Would any wizard out there be wiling to help or do it for me?

One way (select the range of cells to convert before running):

Public Sub AddHyperlinksToSelection()
Dim rCell As Range
With Selection.Cells
.ClearFormats
.Hyperlinks.Delete
For Each rCell In .Cells
With rCell
If Not IsEmpty(.Value) Then _
.Parent.Hyperlinks.Add _
Anchor:=.Cells, _
Address:=.Text, _
TextToDisplay:=.Text
End With
Next rCell
End With
End Sub

Note that it doesn't do any error checking (except skipping blank cells).
 

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

Top