Changing a Macro

  • Thread starter Thread starter Michael Koerner
  • Start date Start date
M

Michael Koerner

I received this macro awhile back. It works as advertised for the most part.
Unless the data to be converted is in a column other than "L".

What do I need to change to define the convertRng as the range I have selected?


Sub convertToHypers()
Dim convertRng As Range
Set convertRng = Range("L2:L1444")
Dim rng As Range

For Each rng In convertRng
If rng.Value <> "" Then
ActiveSheet.Hyperlinks.Add rng, "mailto:" & rng.Value
End If
Next rng

End Sub
 
(1) Change "Set convertRng = Range("L2:L1444")" to "Set convertRng =
Selection"
(2) Select the range of cells you want to work with.
(3) Run the macro.

Ed
 
Sub convertToHypers()
Dim convertRng As Range
'Set convertRng = Range("L2:L1444")
Set convertRng = Selection
Dim rng As Range

For Each rng In convertRng
If rng.Value <> "" Then
ActiveSheet.Hyperlinks.Add rng, "mailto:" & rng.Value
End If
Next rng

End Sub
 
Ed, Tom, thank you very much. greatly appreciated.

--

Regards
Michael Koerner


Sub convertToHypers()
Dim convertRng As Range
'Set convertRng = Range("L2:L1444")
Set convertRng = Selection
Dim rng As Range

For Each rng In convertRng
If rng.Value <> "" Then
ActiveSheet.Hyperlinks.Add rng, "mailto:" & rng.Value
End If
Next rng

End Sub
 

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

Back
Top