仅当列中的数字以“ 0”开头时,我才尝试在该列的数字前添加撇号。列中混合了许多不同的数字,但是对于并非以零开头的数字,我不希望添加撇号。
Sub RANGE
For Each Cell in Range ("E:E")
If cell.value= starts with a 0 then Cell.value = " ' "
Sub Addapostrophe()
For Each cell In Selection
cell.Value = "'" & cell.Value
Next cell
End Sub
答案 0 :(得分:0)
这将起作用...
Sub Addapostrophe()
Dim rng As Range
Set rng = Range("E:E")
For Each cell In rng
If Left(cell.Value, 1) = 0 Then
cell.Value = "'" & cell.Value
End If
Next
End Sub