Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Automation error with validation object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Raj - 28 May 2008 18:11 GMT
Hi,

I was using the following code to create a validation list in column
A:

Sub rProducts()
      Application.Goto
Reference:=Worksheets("ProductMaster").Range("a4:a65536")
   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.

PS: I had posted this earlier and Bob Phillips had suggested to check
whether the named "categories" existed. It does exist.

Is there any other way of adding a validation list in a range using a
named category or range?. As the validation list range is dependent on
a value in another cell of another sheet, I need to do this through
VBA

Regards,
Raj
JW - 28 May 2008 18:20 GMT
> Hi,
>
[quoted text clipped - 37 lines]
> Regards,
> Raj

Ran this several times and had no problems.

Sub rProducts()
   With Worksheets("ProductMaster").Range("a4:a65536").Validation
       .Delete
       .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
           Operator:=xlBetween, Formula1:="=categories"
       .IgnoreBlank = True
       .InCellDropdown = True
   End With
End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.