将文本转换为电子邮件的VBA代码

10-10

以下代码可循环访问一列范围数据,并将每个条目转换为一个电子邮件地址。

Dim convertRng As Range

'Change the range to suit your need.

Set convertRng = Range("Z1:Z99")

Dim rng As Range

For Each rng In convertRng

If rng.Value <> "" Then

ActiveSheet.Hyperlinks.Add rng, "mailto:" & rng.Value

End If

Next rng