VBA“无效的限定词错误"; [英] VBA "Invalid Qualifier Error"

查看:282
本文介绍了VBA“无效的限定词错误";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此代码上获得无效的限定词错误,不知道为什么.

Getting an Invalid Qualifier Error on this code, have no idea why.

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 

此部分显示为错误原因

MsgBox"totalamount ="& 总计.值

MsgBox "totalamount = " & totalamount.Value

推荐答案

总量是一个整数-它不是对象.一个对象就像一个范围(例如sheets(1).Range("A1")).对象具有属性,例如value属性.在这种情况下,您只需要

Totalamount is an integer - it is not an object. An object is something like a range (ie: sheets(1).Range("A1")). Objects have properties, such as the value property. In this case, all you need is

MsgBox "totalamount = " & totalamount

这篇关于VBA“无效的限定词错误";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆