有两种方法,一是上传你的附件我来帮你完成,另一种方法是我将宏代码粘贴上来,你自己将它粘贴到你的VBE中,你说呢?(有关VBE中的操作,你可以搜索一下“F11”关键字,如http://club.excelhome.net/viewthread.php?tid=67526&replyID=326887&skin=1) 代码如下: Sub StandardNumber() Dim i As Range, Acell As Cell, CR As Range, YN As String On Error Resume Next Application.ScreenUpdating = False If Selection.Type = 2 Then For Each i In Selection.Words If i Like "####*" = True Then If i.Next Like "." = True And i.Next(wdWord, 2) Like "#*" = True Then i.SetRange Start:=i.Start, End:=i.Next(wdWord, 2).End i = Format(i, "Standard") Else i = Format(i, "Standard") End If End If Next i ElseIf Selection.Type = 5 Then For Each Acell In Selection.Cells Set CR = ActiveDocument.Range(Acell.Range.Start, Acell.Range.End - 1) If CR Like "####*" = True Then If CR Like "####.#*" = True Then YN = Format(CR, "Standard") CR.Text = YN Else YN = Format(CR, "Standard") CR.Text = YN End If End If Next Acell Else MsgBox "您只能选定文本或者表格之一!", vbOK + vbInformation End If Application.ScreenUpdating = True End Sub 运行此宏即可,相关操作在二楼贴子的链接中已经讲过了。 |