VBA"无效的资格者错误"

时间:2015-08-11 14:13:13

标签: excel vba

在此代码上获取无效的限定符错误,不知道原因。

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 =" &安培; totalamount .Value

2 个答案:

答案 0 :(得分:6)

Totalamount是一个整数 - 它不是一个对象。对象类似于范围(即:sheet(1).Range(“A1”))。对象具有属性,例如value属性。在这种情况下,您只需要

MsgBox "totalamount = " & totalamount

答案 1 :(得分:2)

只需从public class DBHandler extends Handler { public DBHandler() { LogManager m = LogManager.getLogManager(); String p = getClass().getName(); String v = m.getProperty(p + ".level"); try { if (v != null) { super.setLevel(Level.parse(v)); } } catch (RuntimeException re) { reportError(v, re, ErrorManager.OPEN_FAILURE); } //@todo create code to parse filter, formatter, encoding, etc. } @Override public void close() throws SecurityException { } @Override public void flush() { } @Override public void publish(LogRecord logRecord) { if (isLoggable(logRecord)) { try { //SQL call to insert onDB } catch (Exception e) { reportError("", e, ErrorManager.WRITE_FAILURE); } } } } 移除.Value即可。

totalAmount.Value是原始类型的变量,原始变量没有方法。

totalAmount