在编码方面我是一个菜鸟...所以我有一个相当简单的代码,将原始数据作为文本格式转换为数字。代码一直有效,直到我从原始数据表切换到"个人KPI"因此当我在单独的kpi表上并运行宏时,我得到了运行时错误。
Sub AccountRecon()
Range("Table_ACCTDATA[[ARP Check Project, prep & formatting spreadsheets Volume]:[Review / Approve GL Reconciliations Minutes]]").Select
With Selection
Selection.NumberFormat = "0.0"
.Value = .Value
End With
End Sub
答案 0 :(得分:0)
键入
时With Something
这意味着Something
位于with .. end with
的每一行之前。
修正错误会产生:
Sub AccountRecon()
Range("Table_ACCTDATA[[ARP Check Project, prep & formatting spreadsheets Volume]:[Review / Approve GL Reconciliations Minutes]]").Select
With Selection
.NumberFormat = "0.0" 'Removed "Selection"
.Value = .Value
End With
End Sub