我在我的代碼中找不到任何錯誤,但是「對象需要」錯誤不斷出現。 有人可以請幫忙。我一直在這,試圖修復它半小時,我仍然無法找到問題。任何幫助,將不勝感激。 謝謝!編譯錯誤 - 需要的對象
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