前台的小妹正在整理客户的相关信息,一个一个的输入客户的信息, 再一个一个的去校对。。怎么看的下去啊,so…
具体代码
Sub testPhone()
Dim sh As Worksheet
Set sh = Worksheets("sheet1")
Dim row As Integer
Dim phone As String
Dim Column As Integer
Set oRegExp = CreateObject("vbscript.regexp")
With oRegExp
.Global = True
.IgnoreCase = True
.Pattern = "(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}1[3-9][0-9]{9}$)"
End With
row = 1
Column = 2 '手机号所在的列 A=1 这里要变的
Do
phone = sh.Cells(row, Column)
If Not oRegExp.Test(phone) Then
sh.Cells(row, Column).Font.Color = RGB(255, 0, 0)
End If
sh.Cells(row, Column) = "'" + phone
row = row + 1
Loop Until sh.Cells(row, Column) = ""
End Sub
跟小妹说,点一下,红色的就是电话号码输入有误的。