ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automation error (https://www.excelbanter.com/excel-programming/411365-automation-error.html)

Raj[_2_]

Automation error
 
Hi,

I was using the following code to create a validation list in column A
in the range specified below.

Sub rProducts()
Application.Goto
Reference:=Worksheets("ProductMaster").Range("a4:a 65536")
ActiveWindow.ScrollRow = 1
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="=categories"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub

This was working fine. Suddenly, it has stopped working and
"Automation Error" is displayed. When debug is clicked, the line
beginning ".Add" is highlighted.

Please help with a solution.

Regards,
Raj

Bob Phillips

Automation error
 
Sounds as if you don't have a range named categories.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Raj" wrote in message
...
Hi,

I was using the following code to create a validation list in column A
in the range specified below.

Sub rProducts()
Application.Goto
Reference:=Worksheets("ProductMaster").Range("a4:a 65536")
ActiveWindow.ScrollRow = 1
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="=categories"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub

This was working fine. Suddenly, it has stopped working and
"Automation Error" is displayed. When debug is clicked, the line
beginning ".Add" is highlighted.

Please help with a solution.

Regards,
Raj





All times are GMT +1. The time now is 09:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com