VBA excel 宏 请教下,这个代码错在哪了
如题Suba()Dima,b,iForH=1To12IfInStr(Cells(i,1),"[")>0ThenDimM(),N()i=0b=0a=Cells(i,1)Do...
如题
Sub a()
Dim a, b, i
For H = 1 To 12
If InStr(Cells(i, 1), "[") > 0 Then
Dim M(), N()
i = 0
b = 0
a = Cells(i, 1)
Do While InStr(a, "[") <> 0
ReDim Preserve M(i + 1)
ReDim Preserve N(i + 1)
M(i) = InStr(a, "[") + b
N(i) = InStr(a, "]") + b
a = Mid(a, N(i) + 1)
b = Len(Cells(i, 1)) - Len(a)
i = i + 1
Loop
For J = 0 To UBound(M)
With Cells(a, b).Characters(M(J) + 1, N(J) - M(J) - 1).Font
.Color = -16776961
.Size = 16
End With
Next
End If
Next
End Sub 展开
Sub a()
Dim a, b, i
For H = 1 To 12
If InStr(Cells(i, 1), "[") > 0 Then
Dim M(), N()
i = 0
b = 0
a = Cells(i, 1)
Do While InStr(a, "[") <> 0
ReDim Preserve M(i + 1)
ReDim Preserve N(i + 1)
M(i) = InStr(a, "[") + b
N(i) = InStr(a, "]") + b
a = Mid(a, N(i) + 1)
b = Len(Cells(i, 1)) - Len(a)
i = i + 1
Loop
For J = 0 To UBound(M)
With Cells(a, b).Characters(M(J) + 1, N(J) - M(J) - 1).Font
.Color = -16776961
.Size = 16
End With
Next
End If
Next
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询