|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
原语句如下:
myText = Documents(2).Tables(1).Cell(1, 6).Range
If myText <= 10 Then
With Selection.ParagraphFormat
.LineSpacingRule = wdLineSpaceExactly '指定段落的行距
.LineSpacing = 27.2 '行距固定值
End With
Else
If myText <= 12 Then
With Selection.ParagraphFormat
.LineSpacingRule = wdLineSpaceExactly '指定段落的行距
.LineSpacing = 27.15 '行距固定值
End With
Else
If myText <= 14 Then
With Selection.ParagraphFormat
.LineSpacingRule = wdLineSpaceExactly '指定段落的行距
.LineSpacing = 27.1 '行距固定值
End With
Else
If myText <= 16 Then
With Selection.ParagraphFormat
.LineSpacingRule = wdLineSpaceExactly '指定段落的行距
.LineSpacing = 27.2 '行距固定值
End With
Else
If myText <= 18 Then
With Selection.ParagraphFormat
.LineSpacingRule = wdLineSpaceExactly '指定段落的行距
.LineSpacing = 27.35 '行距固定值
End With
Else
With Selection.ParagraphFormat
.LineSpacingRule = wdLineSpaceExactly '指定段落的行距
.LineSpacing = 27.35 '行距固定值
End With
End If
End If
End If
End If
End If
我尝试用数组解决,但失败了:
Dim CX, DX, EX()
CX = "12345"
DX = Array("<=10", "<=12", "<=14", "<=16", "<=18", ">=19")
EX = Array("27.2", "27.15", "27.1", "27.2", "27.35", "27.35")
MM = 17
NN = DX(InStr(CX, Mid(MM, 1, 2)) - 1)
LL = EX(InStr(CX, Mid(NN, 1, 4)) - 1)
MsgBox NN
MsgBox LL |
|