Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Remove Data Validation with macro

Hi there,

I thought that this would be easy, what I want to do is remove Data
Validation from ranges in a number of sheets.

I recorded the macro below - but it won't run - runtime error 1004

Application.Goto Reference:="R1C1"
ActiveCell.SpecialCells(xlCellTypeAllValidation).S elect
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween 'BUGS OUT HERE
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Cells.Select
Range("B5").Activate
Selection.EntireRow.Hidden = False
Range("H1:H4").Select
Selection.ClearContents
Rows("1:4").Select
Range("B1").Activate
Selection.EntireRow.Hidden = True

Any help would be appreciated

Thank you
--
Mifty
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Remove Data Validation with macro

This works fine for me

For Each ws In ActiveWorkbook.Worksheets

On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not rng Is Nothing Then

For Each cell In rng

With cell.Validation
.Delete
.Add Type:=xlValidateInputOnly,
AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween 'BUGS OUT HERE
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Next cell
End If
Next ws


--
__________________________________
HTH

Bob

"Mifty" wrote in message
...
Hi there,

I thought that this would be easy, what I want to do is remove Data
Validation from ranges in a number of sheets.

I recorded the macro below - but it won't run - runtime error 1004

Application.Goto Reference:="R1C1"
ActiveCell.SpecialCells(xlCellTypeAllValidation).S elect
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween 'BUGS OUT HERE
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Cells.Select
Range("B5").Activate
Selection.EntireRow.Hidden = False
Range("H1:H4").Select
Selection.ClearContents
Rows("1:4").Select
Range("B1").Activate
Selection.EntireRow.Hidden = True

Any help would be appreciated

Thank you
--
Mifty



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Remove Data Validation with macro

Hi Bob,

Thanks for responding :-)

I'm not sure what I'm doing wrong but I'm still getting a problem
I get a compile error - syntax error now when I try to debug. same bit of code

Cheers
--
Mifty


"Bob Phillips" wrote:

This works fine for me

For Each ws In ActiveWorkbook.Worksheets

On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not rng Is Nothing Then

For Each cell In rng

With cell.Validation
.Delete
.Add Type:=xlValidateInputOnly,
AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween 'BUGS OUT HERE
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Next cell
End If
Next ws


--
__________________________________
HTH

Bob

"Mifty" wrote in message
...
Hi there,

I thought that this would be easy, what I want to do is remove Data
Validation from ranges in a number of sheets.

I recorded the macro below - but it won't run - runtime error 1004

Application.Goto Reference:="R1C1"
ActiveCell.SpecialCells(xlCellTypeAllValidation).S elect
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween 'BUGS OUT HERE
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Cells.Select
Range("B5").Activate
Selection.EntireRow.Hidden = False
Range("H1:H4").Select
Selection.ClearContents
Rows("1:4").Select
Range("B1").Activate
Selection.EntireRow.Hidden = True

Any help would be appreciated

Thank you
--
Mifty




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Remove Data Validation with macro

Maybe wrap-around

For Each ws In ActiveWorkbook.Worksheets

On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not rng Is Nothing Then

For Each cell In rng

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


--
__________________________________
HTH

Bob

"Mifty" wrote in message
...
Hi Bob,

Thanks for responding :-)

I'm not sure what I'm doing wrong but I'm still getting a problem
I get a compile error - syntax error now when I try to debug. same bit of
code

Cheers
--
Mifty


"Bob Phillips" wrote:

This works fine for me

For Each ws In ActiveWorkbook.Worksheets

On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not rng Is Nothing Then

For Each cell In rng

With cell.Validation
.Delete
.Add Type:=xlValidateInputOnly,
AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween 'BUGS OUT HERE
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Next cell
End If
Next ws


--
__________________________________
HTH

Bob

"Mifty" wrote in message
...
Hi there,

I thought that this would be easy, what I want to do is remove Data
Validation from ranges in a number of sheets.

I recorded the macro below - but it won't run - runtime error 1004

Application.Goto Reference:="R1C1"
ActiveCell.SpecialCells(xlCellTypeAllValidation).S elect
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween 'BUGS OUT HERE
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Cells.Select
Range("B5").Activate
Selection.EntireRow.Hidden = False
Range("H1:H4").Select
Selection.ClearContents
Rows("1:4").Select
Range("B1").Activate
Selection.EntireRow.Hidden = True

Any help would be appreciated

Thank you
--
Mifty






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Remove Data Validation with macro

Hi Bob,

I'm going to have to do it the old fashioned way sheet by sheet - but I'll
come back to this when I have some time to look at it properly. It WILL work

Thanks for all your help. I'll repost at the sage we left off

Cheers
--
Mifty


"Bob Phillips" wrote:

Maybe wrap-around

For Each ws In ActiveWorkbook.Worksheets

On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not rng Is Nothing Then

For Each cell In rng

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


--
__________________________________
HTH

Bob

"Mifty" wrote in message
...
Hi Bob,

Thanks for responding :-)

I'm not sure what I'm doing wrong but I'm still getting a problem
I get a compile error - syntax error now when I try to debug. same bit of
code

Cheers
--
Mifty


"Bob Phillips" wrote:

This works fine for me

For Each ws In ActiveWorkbook.Worksheets

On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not rng Is Nothing Then

For Each cell In rng

With cell.Validation
.Delete
.Add Type:=xlValidateInputOnly,
AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween 'BUGS OUT HERE
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Next cell
End If
Next ws


--
__________________________________
HTH

Bob

"Mifty" wrote in message
...
Hi there,

I thought that this would be easy, what I want to do is remove Data
Validation from ranges in a number of sheets.

I recorded the macro below - but it won't run - runtime error 1004

Application.Goto Reference:="R1C1"
ActiveCell.SpecialCells(xlCellTypeAllValidation).S elect
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween 'BUGS OUT HERE
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Cells.Select
Range("B5").Activate
Selection.EntireRow.Hidden = False
Range("H1:H4").Select
Selection.ClearContents
Rows("1:4").Select
Range("B1").Activate
Selection.EntireRow.Hidden = True

Any help would be appreciated

Thank you
--
Mifty








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove blank cells from data validation drop down box Jay Excel Worksheet Functions 3 December 8th 09 04:16 PM
Remove dashs from macro data Optitron[_33_] Excel Programming 3 July 25th 06 04:58 PM
How do I remove data validation enteries in Excel 97? Marc Excel Discussion (Misc queries) 1 July 12th 06 12:12 AM
Remove Data validation Input messages Mark Excel Programming 3 July 2nd 04 04:14 PM
Looping Macro to remove data where value is 0 Paul Excel Programming 3 January 10th 04 08:08 AM


All times are GMT +1. The time now is 10:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"