我遇到以下代码块的问题。在Excel 2010中正常工作,但在Excel 2013中无效。
2013 VBA中的OLE控件对象是否存在问题,或者我遗漏了什么?
代码停在“ActiveSheet.monthOneBudTxt.Value = Format(Range(”JanBud“)。Value,”$ ###,###“)”并返回错误:
运行时错误438对象不支持此属性或方法
Sub firstQtrByMonth()
'MsgBox "The name of the active sheet is " & ActiveSheet.Name
ActiveSheet.monthOneBudTxt.Value = Format(Range("JanBud").Value, "$###,###")
ActiveSheet.monthOneLabel.Value = "Jan"
ActiveSheet.monthTwoBudTxt.Value = Format(Range("FebBud").Value, "$###,###")
ActiveSheet.monthTwoLabel.Value = "Feb"
ActiveSheet.monthThreeBudTxt.Value = Format(Range("MarBud").Value, "$###,###")
ActiveSheet.monthThreeLabel.Value = "Mar"
ActiveSheet.monthOneActTxt.Value = Format(Range("JanAct").Value, "$###,###")
ActiveSheet.monthTwoActTxt.Value = Format(Range("FebAct").Value, "$###,###")
ActiveSheet.monthThreeActTxt.Value = Format(Range("MarAct").Value, "$###,###")
ActiveSheet.monthOneIncDecTxt.Value = Format((ActiveSheet.monthOneActTxt.Value / ActiveSheet.monthOneBudTxt.Value), "#%")
ActiveSheet.monthTwoIncDecTxt.Value = Format((ActiveSheet.monthTwoActTxt.Value / ActiveSheet.monthTwoBudTxt.Value), "#%")
ActiveSheet.monthThreeIncDecTxt.Value = Format((ActiveSheet.monthThreeActTxt.Value / ActiveSheet.monthThreeBudTxt.Value), "#%")
'ActiveSheet.monthlyBreakDownHeader.Value = "1st Qtr Monthly Breakdown"
'ActiveSheet.quarterlyBreakdownHeader.Value = "1st Qtr Analysis"
ActiveSheet.QtrBudTotal.Value = Format(ActiveSheet.monthOneBudTxt.Value + ActiveSheet.monthOneBudTxt.Value + _
ActiveSheet.monthOneBudTxt.Value, "$###,###")
ActiveSheet.QtrActTotal.Value = Format(ActiveSheet.monthOneActTxt.Value + ActiveSheet.monthOneActTxt.Value + _
ActiveSheet.monthOneActTxt.Value, "$###,###")
ActiveSheet.monthOneVariance.Value = Format(ActiveSheet.monthOneActTxt.Value - ActiveSheet.monthOneBudTxt.Value, "$###,###")
ActiveSheet.monthTwoVariance.Value = Format(ActiveSheet.monthTwoActTxt.Value - ActiveSheet.monthTwoBudTxt.Value, "$###,###")
ActiveSheet.monthThreeVariance.Value = Format(ActiveSheet.monthThreeActTxt.Value - ActiveSheet.monthThreeBudTxt.Value, "$###,###")
'ActiveSheet.cisCompBreakDownHeader.Value = "First Quarter CIS Comparison"
End Sub
答案 0 :(得分:1)
似乎是本月初更新缺陷的另一种表现形式。