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 / New Users / September 2006

Tip: Looking for answers? Try searching our database.

Problem with changing a cell validation through VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Remco - 22 Sep 2006 10:26 GMT
Dear all,

I have a problem with a macro which I have recorded in Excel. The macro
comes with an error in running the recorded script. This error is:
Run-time error '1004': Application-defined of object-defined error.

This is the VBA-coding which has the problem:

    Range("A12").Validation _
   .Modify xlValidateCustom,
Formula1:="=AND(COUNTIF($A$11:$A$52;$A12)<2;VLOOKUP($A12;PRODUCTS;3;F­ALSE)=""RED"")"

Momentarily the cell has the same validation, only the Vlookup has to
match "YELLOW". This rule has been manually entered and works correct.
When the cell validation is changed manually into "RED", there is also
no problem.

Only the funny part is, when I record this change and re-run it, VBA
shows the above mentioned error.

I have been trying to change this little script, but I still did not
manage to make it run. Can someone help me with this issue?

Who can help me on this subject?
Thanks in advance.
Dave Peterson - 22 Sep 2006 13:11 GMT
Try using a comma instead of a semicolon in your formula1 expression.  VBA is
pretty USA centric.

> Dear all,
>
[quoted text clipped - 21 lines]
> Who can help me on this subject?
> Thanks in advance.

Signature

Dave Peterson

Remco - 22 Sep 2006 13:27 GMT
Dave,

I have altered the statement as you suggested. It does not solve the
problem.
More ideas?

Thanks in advance.

> Try using a comma instead of a semicolon in your formula1 expression.  VBA is
> pretty USA centric.
[quoted text clipped - 24 lines]
> > Who can help me on this subject?
> > Thanks in advance.
Dave Peterson - 22 Sep 2006 13:41 GMT
You sure you got all the semicolons changed to commas?

Since you're using .modify, does that cell have existing Data|validiation rules?

> Dave,
>
[quoted text clipped - 36 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

Remco - 22 Sep 2006 14:38 GMT
Dave,

Yes, we have changed all semicolons to commas. And yes, we did have a
validation-rule on the cell. The only thing is that this validation was
entered manually, instead of through VBA.

> You sure you got all the semicolons changed to commas?
>
[quoted text clipped - 40 lines]
> > >
> > > Dave Peterson
Dave Peterson - 22 Sep 2006 16:01 GMT
I don't have a guess.  It worked when I used commas and replaced the existing
rule.

> Dave,
>
[quoted text clipped - 50 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

 
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.