PC Review


Reply
Thread Tools Rate Thread

Automation error with validation object

 
 
Raj
Guest
Posts: n/a
 
      28th May 2008
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
 
Reply With Quote
 
 
 
 
JW
Guest
Posts: n/a
 
      28th May 2008
On May 28, 1:11*pm, Raj <rsp...@gmail.com> wrote:
> 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


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
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automation Object error Natalie Microsoft Access 0 11th Aug 2009 07:37 PM
object does not contain automation object form- error vandy Microsoft Access Macros 5 4th Jun 2008 09:20 AM
Protected sheet: Automation error for validation Raj Microsoft Excel Programming 0 29th May 2008 01:45 AM
Adding validation fails with automation error PhilipAppsWork@gmail.com Microsoft Excel Programming 4 13th Feb 2008 08:30 PM
Error: The Object doesnt contain the Automation Object =?Utf-8?B?QXBwYWNoZQ==?= Microsoft Access VBA Modules 0 12th Jun 2006 06:38 PM


Features
 

Advertising
 

Newsgroups
 


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