Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 152
Default Data validation formula in cell and list?

Good morning. I'd like to have formula in B2 that returns NA if B1 is No, if
B1 is Yes, i'd like to force drop down selection or validation in B2 of
Yes/No - is this possible?

A B
1 Was it cold enough to snow? Yes/No
2 Did it snow? =if(B1="No",NA)

--
Thank you -- Suzanne.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Data validation formula in cell and list?

You need an event sub for that, something like this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B1" Then
If Target.Value = "No" Then
Range("B2").Validation.Delete
Range("B2").Value = "NA"
Else
Range("B2").Value = ""
Range("B2").Validation.Delete
Range("B2").Validation.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No"
Range("B2").Select
End If
End If
End Sub

Regards,
Stefi


€žSuzanne€ť ezt Ă*rta:

Good morning. I'd like to have formula in B2 that returns NA if B1 is No, if
B1 is Yes, i'd like to force drop down selection or validation in B2 of
Yes/No - is this possible?

A B
1 Was it cold enough to snow? Yes/No
2 Did it snow? =if(B1="No",NA)

--
Thank you -- Suzanne.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 152
Default Data validation formula in cell and list?

Very fancy! Thanks i will give it a try, i appreciate the response.
--
Thank you -- Suzanne.


"Stefi" wrote:

You need an event sub for that, something like this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B1" Then
If Target.Value = "No" Then
Range("B2").Validation.Delete
Range("B2").Value = "NA"
Else
Range("B2").Value = ""
Range("B2").Validation.Delete
Range("B2").Validation.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No"
Range("B2").Select
End If
End If
End Sub

Regards,
Stefi


€žSuzanne€ť ezt Ă*rta:

Good morning. I'd like to have formula in B2 that returns NA if B1 is No, if
B1 is Yes, i'd like to force drop down selection or validation in B2 of
Yes/No - is this possible?

A B
1 Was it cold enough to snow? Yes/No
2 Did it snow? =if(B1="No",NA)

--
Thank you -- Suzanne.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Data validation formula in cell and list?

You are welcome! Thanks for the feedback! Please post the result of the try!
Stefi

€žSuzanne€ť ezt Ă*rta:

Very fancy! Thanks i will give it a try, i appreciate the response.
--
Thank you -- Suzanne.


"Stefi" wrote:

You need an event sub for that, something like this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B1" Then
If Target.Value = "No" Then
Range("B2").Validation.Delete
Range("B2").Value = "NA"
Else
Range("B2").Value = ""
Range("B2").Validation.Delete
Range("B2").Validation.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No"
Range("B2").Select
End If
End If
End Sub

Regards,
Stefi


€žSuzanne€ť ezt Ă*rta:

Good morning. I'd like to have formula in B2 that returns NA if B1 is No, if
B1 is Yes, i'd like to force drop down selection or validation in B2 of
Yes/No - is this possible?

A B
1 Was it cold enough to snow? Yes/No
2 Did it snow? =if(B1="No",NA)

--
Thank you -- Suzanne.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 152
Default Data validation formula in cell and list?

Again thanks for your help, this is quite new to me. I pasted your code in
my vb editor and made the adjustments to the target cells:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "i71" Then
If Target.Value = "No" Then
Range("i72").Validation.Delete
Range("i72").Value = "NA"
Else
Range("i72").Value = ""
Range("i72").Validation.Delete
(HERE) Range("i72").Validation.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No" (-- TO HERE APPEARS IN RED
FONT
Range("i72").Select do i still need
a list or the list is the
End If "Yes,No"
in the code? THANKS!)
End If
End Sub

--
Thank you -- Suzanne.


"Stefi" wrote:

You are welcome! Thanks for the feedback! Please post the result of the try!
Stefi

€žSuzanne€ť ezt Ă*rta:

Very fancy! Thanks i will give it a try, i appreciate the response.
--
Thank you -- Suzanne.


"Stefi" wrote:

You need an event sub for that, something like this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B1" Then
If Target.Value = "No" Then
Range("B2").Validation.Delete
Range("B2").Value = "NA"
Else
Range("B2").Value = ""
Range("B2").Validation.Delete
Range("B2").Validation.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No"
Range("B2").Select
End If
End If
End Sub

Regards,
Stefi


€žSuzanne€ť ezt Ă*rta:

Good morning. I'd like to have formula in B2 that returns NA if B1 is No, if
B1 is Yes, i'd like to force drop down selection or validation in B2 of
Yes/No - is this possible?

A B
1 Was it cold enough to snow? Yes/No
2 Did it snow? =if(B1="No",NA)

--
Thank you -- Suzanne.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Data validation formula in cell and list?

The forum's editor can't handle long code lines properly, I inserted a line
separator to split up long line:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "I71" Then
If Target.Value = "No" Then
Range("I72").Validation.Delete
Range("I72").Value = "NA"
Else
Range("I72").Value = ""
Range("I72").Validation.Delete
Range("I72").Validation.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No" 'this is the list built in the
code
Range("I72").Select
End If
End If
End Sub

Don't forget to paste the code in the worksheet code window (NOT in a normal
module!)

Stefi


€žSuzanne€ť ezt Ă*rta:

Again thanks for your help, this is quite new to me. I pasted your code in
my vb editor and made the adjustments to the target cells:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "i71" Then
If Target.Value = "No" Then
Range("i72").Validation.Delete
Range("i72").Value = "NA"
Else
Range("i72").Value = ""
Range("i72").Validation.Delete
(HERE) Range("i72").Validation.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No" (-- TO HERE APPEARS IN RED
FONT
Range("i72").Select do i still need
a list or the list is the
End If "Yes,No"
in the code? THANKS!)
End If
End Sub

--
Thank you -- Suzanne.


"Stefi" wrote:

You are welcome! Thanks for the feedback! Please post the result of the try!
Stefi

€žSuzanne€ť ezt Ă*rta:

Very fancy! Thanks i will give it a try, i appreciate the response.
--
Thank you -- Suzanne.


"Stefi" wrote:

You need an event sub for that, something like this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B1" Then
If Target.Value = "No" Then
Range("B2").Validation.Delete
Range("B2").Value = "NA"
Else
Range("B2").Value = ""
Range("B2").Validation.Delete
Range("B2").Validation.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No"
Range("B2").Select
End If
End If
End Sub

Regards,
Stefi


€žSuzanne€ť ezt Ă*rta:

Good morning. I'd like to have formula in B2 that returns NA if B1 is No, if
B1 is Yes, i'd like to force drop down selection or validation in B2 of
Yes/No - is this possible?

A B
1 Was it cold enough to snow? Yes/No
2 Did it snow? =if(B1="No",NA)

--
Thank you -- Suzanne.

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
Combining Formula and Data Validation List in a Single Cell Benny Excel Worksheet Functions 0 May 13th 08 09:48 PM
Combine Formula and Data Validation List in a Single Cell ?? monir Excel Worksheet Functions 3 March 2nd 08 11:17 PM
FORMULA WITH A CELL THAT HAS A DATA VALIDATION LIST IN IT armymatt Excel Worksheet Functions 2 February 13th 08 10:43 PM
Deleting formula in data validation list Dannycol Excel Worksheet Functions 2 April 15th 06 10:01 PM
HELP: Data > Validation ---List ----Formula amit Excel Worksheet Functions 3 April 15th 05 01:38 PM


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

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"