Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Putting named range into sub written by Tom Olgivy DataVal

Hi everyone,

I've found this routine written by Tom Olgivy that allows you to reset all
the data validation in a column.

I would like to change it to reset data val cells to blank ="" which is the
2nd option in the data val.

The data val cells are in non-contiguous rows ( rows 3,5,7,9,11) on columns
B to F. I've made these into a named range RngDV.

I got stuck very easily because I didn't know how to replace entirecolumn in
the code below
Sub ResetBox()
Dim r As Range
Dim r1 As Range
Set r = Range("B1").EntireColumn
On Error Resume Next
Set r2 = r.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not r2 Is Nothing Then
For Each cell In r2
If cell.Validation.Type = xlValidateList Then
cell.Value = ""
End If
Next
Else
MsgBox "No Data Validation Cells)"
End If
End Sub

I'd appreciate any help :-)
Thank you
--
Mifty
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Putting named range into sub written by Tom Olgivy DataVal

Try replacing:

Set r = Range("B1").EntireColumn
with:
Set r = Range("B3:F11")

r2 should still pickup the Validation cells.
--
Gary''s Student - gsnu200802


"Mifty" wrote:

Hi everyone,

I've found this routine written by Tom Olgivy that allows you to reset all
the data validation in a column.

I would like to change it to reset data val cells to blank ="" which is the
2nd option in the data val.

The data val cells are in non-contiguous rows ( rows 3,5,7,9,11) on columns
B to F. I've made these into a named range RngDV.

I got stuck very easily because I didn't know how to replace entirecolumn in
the code below
Sub ResetBox()
Dim r As Range
Dim r1 As Range
Set r = Range("B1").EntireColumn
On Error Resume Next
Set r2 = r.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not r2 Is Nothing Then
For Each cell In r2
If cell.Validation.Type = xlValidateList Then
cell.Value = ""
End If
Next
Else
MsgBox "No Data Validation Cells)"
End If
End Sub

I'd appreciate any help :-)
Thank you
--
Mifty

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Putting named range into sub written by Tom Olgivy DataVal

Fantastic !!!!

This has made my day so much happier

Thank you so much Gary's Student :-)
--
Mifty


"Gary''s Student" wrote:

Try replacing:

Set r = Range("B1").EntireColumn
with:
Set r = Range("B3:F11")

r2 should still pickup the Validation cells.
--
Gary''s Student - gsnu200802


"Mifty" wrote:

Hi everyone,

I've found this routine written by Tom Olgivy that allows you to reset all
the data validation in a column.

I would like to change it to reset data val cells to blank ="" which is the
2nd option in the data val.

The data val cells are in non-contiguous rows ( rows 3,5,7,9,11) on columns
B to F. I've made these into a named range RngDV.

I got stuck very easily because I didn't know how to replace entirecolumn in
the code below
Sub ResetBox()
Dim r As Range
Dim r1 As Range
Set r = Range("B1").EntireColumn
On Error Resume Next
Set r2 = r.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not r2 Is Nothing Then
For Each cell In r2
If cell.Validation.Type = xlValidateList Then
cell.Value = ""
End If
Next
Else
MsgBox "No Data Validation Cells)"
End If
End Sub

I'd appreciate any help :-)
Thank you
--
Mifty

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Putting named range into sub written by Tom Olgivy DataVal

Perhaps Set r = Range("RngDV")
I also noted that you Dim r1 As Range but use r2 in the code. Is this a
typo?

Mike F

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

I've found this routine written by Tom Olgivy that allows you to reset all
the data validation in a column.

I would like to change it to reset data val cells to blank ="" which is
the
2nd option in the data val.

The data val cells are in non-contiguous rows ( rows 3,5,7,9,11) on
columns
B to F. I've made these into a named range RngDV.

I got stuck very easily because I didn't know how to replace entirecolumn
in
the code below
Sub ResetBox()
Dim r As Range
Dim r1 As Range
Set r = Range("B1").EntireColumn
On Error Resume Next
Set r2 = r.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not r2 Is Nothing Then
For Each cell In r2
If cell.Validation.Type = xlValidateList Then
cell.Value = ""
End If
Next
Else
MsgBox "No Data Validation Cells)"
End If
End Sub

I'd appreciate any help :-)
Thank you
--
Mifty



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Putting named range into sub written by Tom Olgivy DataVal

Hi Mike,

Thanks for replying. I was so chuffed that I got it to work that I didn't
check out any other replies.

I haven't changed R1 or R2 and it's still working - so even though I'd love
to know why - I'm going with the 'If it ain't broke........

Cheers

--
Mifty


"Mike Fogleman" wrote:

Perhaps Set r = Range("RngDV")
I also noted that you Dim r1 As Range but use r2 in the code. Is this a
typo?

Mike F

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

I've found this routine written by Tom Olgivy that allows you to reset all
the data validation in a column.

I would like to change it to reset data val cells to blank ="" which is
the
2nd option in the data val.

The data val cells are in non-contiguous rows ( rows 3,5,7,9,11) on
columns
B to F. I've made these into a named range RngDV.

I got stuck very easily because I didn't know how to replace entirecolumn
in
the code below
Sub ResetBox()
Dim r As Range
Dim r1 As Range
Set r = Range("B1").EntireColumn
On Error Resume Next
Set r2 = r.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If Not r2 Is Nothing Then
For Each cell In r2
If cell.Validation.Type = xlValidateList Then
cell.Value = ""
End If
Next
Else
MsgBox "No Data Validation Cells)"
End If
End Sub

I'd appreciate any help :-)
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
Tracking 'last written to' range Mac Excel Programming 1 April 30th 08 03:20 PM
Array data to Range: Only first value written Post Tenebras Lux Excel Programming 4 June 29th 06 05:54 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM
Searching range for value (code written but needs 'tweaking'!) ian123[_26_] Excel Programming 8 December 23rd 03 05:19 PM


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

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

About Us

"It's about Microsoft Excel"