NumberFormat
似乎是一个简单的函数,但我无法让它工作是一个相当简单的案例。在下面的代码中,VBA告诉我"类型不匹配"。
For j = 1 To last_column + 1
For f = 2 To total_tranches + 1
If allocation(f - 1, j - 1) = Empty And j <> 1 Then
Allo1.Cells(AlShares.Row - 1 + f, j + 1) = 0
Else
Allo1.Cells(AlShares.Row - 1 + f, j + 1) = allocation(f - 1, j - 1)
If j = 1 Then Allo1.Cells(AlShares.Row - 1 + f, j + 1).IndentLevel = 1
If j = 2 Then Allo1.Cells(AlShares.Row - 1 + f, j + 1).NumberFormat = "_($*#,##0_);_($*(#,##0);_($*" - "??_);_(@_)"
End If
Next f
Next j
如果我用"会计"替换特定格式,它就不起作用。请帮忙!
您要求 VBA 减去 2 个字符串"...($*" - "??_.." 所以这是类型不匹配。