Sub 针对选中区域_数字转文本()
Dim cel As Range, rng As Range, i As Integer
'On Error Resume Next '忽略错误,继续执行下一条
i = MsgBox("请勿选中整列" & Chr(13) & Chr(13) & "继续执行请点击确定" & Chr(13) & Chr(13) & "否则请点击取消", vbYesNo)
If i = 7 Then MsgBox ("已取消执行此程序"): Exit Sub
Set rng = Selection
For Each cel In rng
cel.Select
If cel.HasFormula = True Then GoTo line1 '判断是否是公式,如果是公式,则忽略,类似于continue
If IsNumeric(cel.Value) Then cel.Value = "'" & cel.Value '判断是否是数字,如果是数字,那么就转换为文本
line1: 'GOTO这里,类似于continue
Next
MsgBox ("已完成")
End Sub