0

This error is encountered, while running a macro in Excel??

Showing the Highlighted Error

enter image description here

Sub MoveBtn() With Sheet1 .Range("E5").Validation.Delete If Sheet1.Range("B1").Value = "Purchase" Then .Shapes("MoveBtn1").IncrementLeft 30 'NOTE: there must be a space between "IncrementLeft" and "30" .Range("B1").Value = "Sales" .Range("E5").Validation.Add xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Customers" Else: .Shapes("MoveBtn1").IncrementLeft -30 'NOTE: there must be a space between "IncrementLeft" and "-30" .Range("B1").Value = "Purchase" On Error Resume Next .Range("E5").Validation.Add .Range("E5").Validation.Add xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Vendors" End If If .Range("B3").Value = False And .Range("B2").Value <> Empty Then .Range("D" & .Range("B2").Value).Value = .Range("B1").Value 'Set Trans Type End With End Sub 

1 Answer 1

2

Remove that line as the next line is the needed one. The complaint is because that line doesn't have the one required param

expression.Add (Type, AlertStyle, Operator, Formula1, Formula2) 

Type is required.

See https://learn.microsoft.com/en-us/office/vba/api/excel.validation.add

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah I got That Thanks @QHarr For you time.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.