获取此代码的无效限定符错误,不知道为什么.
Dim WTotal As Integer
WTotal = InputBox("Enter the amount of Wash")
Dim Startpoint As Range
Dim totalamount As Integer
Sheets("Sheet2").Select
Set Startpoint = ActiveSheet.Cells.Find(What:="Wash")
Startpoint.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
totalamount = Selection.Count
MsgBox "totalamount = " & totalamount.Value
Run Code Online (Sandbox Code Playgroud)
此部分显示为错误的原因
MsgBox"totalamount ="&totalamount .Value
Totalamount是一个整数 - 它不是一个对象.对象类似于范围(即:sheet(1).Range("A1")).对象具有属性,例如value属性.在这种情况下,您只需要
MsgBox "totalamount = " & totalamount
Run Code Online (Sandbox Code Playgroud)
只需.Value从 中删除totalAmount.Value。
totalAmount是原始类型的变量,并且原始变量没有方法。
Dim WTotal As Integer
WTotal = InputBox("Enter the amount of Wash")
Dim Startpoint As Range
Dim totalamount As Integer
Sheets("Sheet2").Select
Set Startpoint = ActiveSheet.Cells.Find(What:="Wash")
Startpoint.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
totalamount = Selection.Count
MsgBox "totalamount = " & totalamount
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
31619 次 |
| 最近记录: |