PC Review


Reply
Thread Tools Rate Thread

Clearing Validations from many worksheets

 
 
Simka
Guest
Posts: n/a
 
      21st Nov 2008
Hi All,

I am trying to clear all the validations which have been set up on a large
number of worksheets and I am trying this routine but it fails and I'm
getting an 'Error code 438' and I'm not sure how to correct it...Any
Suggestions?

Thanks.

Sub ClearValidation()

For Each WS In ActiveWorkbook.Worksheets

With WS.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With

Next WS

End Sub

 
Reply With Quote
 
 
 
 
john
Guest
Posts: n/a
 
      21st Nov 2008
Try this:

Sub ClearValidation()

For Each ws In ActiveWorkbook.Worksheets

ws.Cells.Validation.Delete

Next ws

End Sub

--
jb


"Simka" wrote:

> Hi All,
>
> I am trying to clear all the validations which have been set up on a large
> number of worksheets and I am trying this routine but it fails and I'm
> getting an 'Error code 438' and I'm not sure how to correct it...Any
> Suggestions?
>
> Thanks.
>
> Sub ClearValidation()
>
> For Each WS In ActiveWorkbook.Worksheets
>
> With WS.Validation
> .Delete
> .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
> Operator _
> :=xlBetween
> .IgnoreBlank = True
> .InCellDropdown = True
> .ShowInput = True
> .ShowError = True
> End With
>
> Next WS
>
> End Sub
>

 
Reply With Quote
 
Simka
Guest
Posts: n/a
 
      21st Nov 2008
Cheers John,

That was pretty easy! Just a simple case of entering the word 'cells'. I
should've thought of that!




"john" wrote:

> Try this:
>
> Sub ClearValidation()
>
> For Each ws In ActiveWorkbook.Worksheets
>
> ws.Cells.Validation.Delete
>
> Next ws
>
> End Sub
>
> --
> jb
>
>
> "Simka" wrote:
>
> > Hi All,
> >
> > I am trying to clear all the validations which have been set up on a large
> > number of worksheets and I am trying this routine but it fails and I'm
> > getting an 'Error code 438' and I'm not sure how to correct it...Any
> > Suggestions?
> >
> > Thanks.
> >
> > Sub ClearValidation()
> >
> > For Each WS In ActiveWorkbook.Worksheets
> >
> > With WS.Validation
> > .Delete
> > .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
> > Operator _
> > :=xlBetween
> > .IgnoreBlank = True
> > .InCellDropdown = True
> > .ShowInput = True
> > .ShowError = True
> > End With
> >
> > Next WS
> >
> > 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
Validations =?Utf-8?B?UCBL?= Microsoft ASP .NET 1 10th Nov 2005 10:01 PM
validations in .NET Newbie Microsoft VB .NET 6 14th May 2004 09:18 PM
Clearing Data ranges from Multiple Worksheets Sam Fowler Microsoft Excel Programming 3 12th Apr 2004 02:04 AM
Validations...... Gary Smith Microsoft ASP .NET 5 16th Feb 2004 12:02 AM
Validations Julie Microsoft Excel Crashes 1 7th Aug 2003 01:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:10 PM.