我在我的代码中找不到任何错误,但是“对象需要”错误不断出现。 有人可以请帮忙。我一直在这,试图修复它半小时,我仍然无法找到问题。任何帮助,将不胜感激。 谢谢!编译错误 - 需要的对象
Private Sub cmdCost_Click()
Dim strCost As Integer
Dim strFixedCost As Integer
Dim strResourceCost As Integer
Dim wksResources As Worksheet
Set wksResources = Application.Workbooks(1).Worksheets("Resources")
Set strFixedCost = 140
If cResources.Text = "" = False Then
If Val(tQuantity.Text) > 0 Then
wksResources.Select
wksResources.Range("B2").Select
Do Until ActiveCell.Value = cResources.Text
ActiveCell.Offset(1, 0).Select
Loop
Set strResourceCost = ActiveCell.Offset(0, 3).Value
Set strCost = strFixedCost + (Val(strResourceCost) * tQuantity)
MsgBox " The price is" & " $" + strCost, Buttons:=vbOKOnly, Title:="Cost"
Else
MsgBox " You have not chosen a quantity.", Buttons:=vbOKOnly, Title:="Cost"
End If
Else
MsgBox " You have not chosen a resource.", Buttons:=vbOKOnly, Title:="Cost"
End If
End Sub
哪一行会抛出错误? – 2014-10-22 07:15:15