Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Data Validation Range Question

Hello. The code below is mostly from the recorder which inserts data
validation for a continuous range. My question is this - Can I make the
range to insert the data validation into be the range (in column B) that has
a 1 in column Z? For example, if cell Z1 has a 1 in it, then create the
data validation in cell B1, and so on all the way down to the bottom of the
list in column B. Thanks in advance!!

wks.Range("B5:B" & wks.Range("D65536").End(xlUp).Row).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="Y,N"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Data Validation Range Question

wks.Range("B5:B" & wks.Range("D65536").End(xlUp).Row).Select
for each cell in selection
if cells(cell.row,"Z").Value = 1 then
With cell.Validation
.Delete
.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop,Operator:= _
xlBetween, Formula1:="Y,N"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End if
Next


"Steph" wrote in message
...
Hello. The code below is mostly from the recorder which inserts data
validation for a continuous range. My question is this - Can I make the
range to insert the data validation into be the range (in column B) that

has
a 1 in column Z? For example, if cell Z1 has a 1 in it, then create the
data validation in cell B1, and so on all the way down to the bottom of

the
list in column B. Thanks in advance!!

wks.Range("B5:B" & wks.Range("D65536").End(xlUp).Row).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="Y,N"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Data Validation Range Question

Beautiful! Thanks Tom!!!

"Tom Ogilvy" wrote in message
...
wks.Range("B5:B" & wks.Range("D65536").End(xlUp).Row).Select
for each cell in selection
if cells(cell.row,"Z").Value = 1 then
With cell.Validation
.Delete
.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop,Operator:= _
xlBetween, Formula1:="Y,N"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End if
Next


"Steph" wrote in message
...
Hello. The code below is mostly from the recorder which inserts data
validation for a continuous range. My question is this - Can I make the
range to insert the data validation into be the range (in column B) that

has
a 1 in column Z? For example, if cell Z1 has a 1 in it, then create the
data validation in cell B1, and so on all the way down to the bottom of

the
list in column B. Thanks in advance!!

wks.Range("B5:B" & wks.Range("D65536").End(xlUp).Row).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="Y,N"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With






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
xls data validation question 2 t Excel Discussion (Misc queries) 2 March 12th 10 03:49 PM
Validation Data using Validation Table cell range..... Dermot Excel Discussion (Misc queries) 16 January 5th 10 09:35 PM
Question about range in validation list Hank Excel Discussion (Misc queries) 2 March 13th 09 08:24 PM
Data Validation Question ALEX Excel Worksheet Functions 5 February 2nd 07 02:46 PM
Data Validation Question Minitman[_4_] Excel Programming 2 September 23rd 04 07:28 PM


All times are GMT +1. The time now is 11:55 PM.

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"