|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
说得那么“难堪!”,朋友,我就给你代码了!没啥大不了的!就算我慈悲为怀了!!!
Sub WordVBA_test()
Dim t As Table, R As Range, Q As Range, c As Cell
If ActiveDocument.Tables.Count < 1 Then Exit Sub
Application.ScreenUpdating = False
For Each t In ActiveDocument.Tables
Set R = t.Range: Set Q = R.Duplicate
With R.Find
Do While .Execute("[\((]*亩*[\))]", , , -1)
If Not R.InRange(Q) Then Exit Do
With R
.Start = .Start + 1: .End = .End - 1: .Text = "公顷": .Select
With Selection
.SelectColumn
For Each c In Selection.Cells
With c.Range
.End = .End - 1
If IsNumeric(.Text) Then
.Text = Round(.Text * 0.06667, 2)
End If
End With
Next
End With
.Start = .End
End With
Loop
End With
Next
ActiveDocument.Range(0, 0).Select
Application.ScreenUpdating = True
MsgBox "Completed!"
End Sub
|
|