|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
* 楼主,你必须将示例文档所要处理的表格区域上方的区域删除,即拆分表格,使要处理的表格变为规则表格,否则,VBA代码无法处理。请试用下面的宏:
- Sub aaaa_Tables_TabStops_v1()
- Dim t As Table, c As Cell, l As Column, i&, j!
- For Each t In ActiveDocument.Tables
- With t.Range
- For i = 1 To 3
- For Each c In .Columns(i).Cells
- c.Range.Characters.Last.InsertBefore Text:=vbTab
- Next
- .Columns(i).Select
- If i = 1 Then
- j = 2.35 '请自行修改!
- ElseIf i = 2 Then
- j = 3.7 '请自行修改!
- ElseIf i = 3 Then
- j = 6.2 '请自行修改!
- End If
- ' Selection.ParagraphFormat.TabStops.ClearAll
- ActiveDocument.DefaultTabStop = CentimetersToPoints(0.74)
- Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(j) _
- , Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderDots
- .Cells(i).Range.Find.Execute "^9", , , 0, , , , , , "", 2
- Next
- End With
- Next
- End Sub
复制代码 |
|