ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing a Macro (https://www.excelbanter.com/excel-programming/322553-changing-macro.html)

Michael Koerner

Changing a Macro
 
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


--

Regards
Michael Koerner




Ed

Changing a Macro
 
(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

"Michael Koerner" wrote in message
...
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


--

Regards
Michael Koerner






Tom Ogilvy

Changing a Macro
 
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

--
Regards,
Tom Ogilvy


"Michael Koerner" wrote in message
...
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


--

Regards
Michael Koerner






Michael Koerner

Changing a Macro
 
Ed, Tom, thank you very much. greatly appreciated.

--

Regards
Michael Koerner


"Tom Ogilvy" wrote in message
...
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

--
Regards,
Tom Ogilvy


"Michael Koerner" wrote in message
...
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


--

Regards
Michael Koerner








All times are GMT +1. The time now is 04:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com