dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,352
- Office Version
- 365
- 2016
- Platform
- Windows
I have an excel table and I am trying to make a value in column E for any row be 3 if these conditions are met
This is my code in the worksheet_change event for the worksheet that has the table I tried to write for the first item in the list but it wouldn't work.
I get an error Wrong number of arguments or invalid property assignment with the following line highlighted
This is part of a larger section of code
Could someone show me what have I done wrong with my code and help me with the rest of the code please?
- If anything lower then 3 is entered in column E
- If the value in column B for that row is any of these values
- Supervised Contact
- Supervised Transport
- Daytime Respite
This is my code in the worksheet_change event for the worksheet that has the table I tried to write for the first item in the list but it wouldn't work.
VBA Code:
If Intersect(Target, Me.ListObjects("CSS_Quote").ListColumns(2).Range) = "Supervised Contact" Then
If Me.ListObjects("CSS_Quote").ListColumns(5).Range < 3 Then
MsgBox "The minimum hourly charge for a Supervised Contact is 3 hours"
Me.ListObjects("CSS_Quote").ListColumns(5) = 3
End If
End If
I get an error Wrong number of arguments or invalid property assignment with the following line highlighted
VBA Code:
.ListColumns(5) =
This is part of a larger section of code
VBA Code:
If Selection.Count = 1 Then
If Intersect(Target, Me.ListObjects("CSS_Quote").ListColumns(6).Range) > 1 Then
If Selection.Count = 1 Then
cars = InputBox("Please enter how many cars are required.")
If cars > 1 Then
Cells(Target.Row, "L") = cars
Else
Cells(Target.Row, "L") = 1
End If
End If
Else
If Intersect(Target, Me.ListObjects("CSS_Quote").ListColumns(6).Range) = 1 Then
Cells(Target.Row, "L") = 1
End If
End If
If Intersect(Target, Me.ListObjects("CSS_Quote").ListColumns(2).Range) = "Supervised Contact" Then
If Me.ListObjects("CSS_Quote").ListColumns(5).Range < 3 Then
MsgBox "The minimum hourly charge for a Supervised Contact is 3 hours"
Me.ListObjects("CSS_Quote").ListColumns(5) = 3
End If
End If
End If
Could someone show me what have I done wrong with my code and help me with the rest of the code please?
Last edited: