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
This part shows up as the cause of the Error
MsgBox "totalamount = " & totalamount .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
Just remove .Value
from totalAmount.Value
.
totalAmount
is a variable of primitive type and primitive variables have no methods.
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
Private Sub UserForm_Initialize()
Set ExpenditureTable = ActiveSheet.ListObjects("Expenditure")
If Calendar1 Is Nothing Then
Set Calendar1 = New cCalendar
With Calendar1
.Add_Calendar_into_Frame Me.CalenderFrame
.UseDefaultBackColors = False
.DayLength = 3
.MonthLength = mlENShort
.Height = 142
.Width = 180
.GridFont.Size = 7
.DayFont.Size = 7
.Refresh
End With
End If
changerecord.Min = 0
changerecord.Max = 0
CurrentRow = ExpenditureTable.ListRows.Count
If CurrentRow > 0 Then
changerecord.Min = 1
changerecord.Max = ExpenditureTable.ListRows.Count
PopulateForm ExpenditureTable.ListRows(ExpenditureTable.ListRows.Count).Range
ExpenditureTable.ListRows(ExpenditureTable.ListRows.Count).Range.Select
UpdatePositionCaption
Else
RecordPosition.Caption = "0 of 0"
End If
End Sub
variable not defined error
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.