Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,934
Default If statement resulting in list choice

Just to be clear about the list of items to be displayed in the dropdown,
you assign them in this line...

.Validation.Add Type:=xlValidateList, _
Formula1:="Item 1,Item 2,Item 3,etc."

The list is comma separated and do *not* put any spaces around the commas to
"neaten things up. Also, make sure you keep the space/underline after the
comma at the end of the first line... it forces VB to consider the two lines
as a single executable statement.

--
Rick (MVP - Excel)


"Sloopy" wrote in message
...
Thank you for your help - that's way above my head for sure but I'll take
some time to see if I can get it to work. Thanks again.

"Rick Rothstein" wrote:

You will need to use VB event code to control the activation/deactivation
of
the validation list. The code below will do that, but I'm not exactly
sure
how to remove the displayed dropdown arrow that appears when A2 is not
set
to a number greater than zero... the visible dropdown arrow that is shown
for this condition is not active though and any entry is permitted for it
(data restriction to the list is only active when A2 is a number greater
than zero)...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim V As Range
If Target.Address = "$A$2" Then
With Range("A3")
On Error GoTo CleanUp
Application.EnableEvents = False
.Validation.Delete
If IsNumeric(Target.Value) Then
If Target.Value 0 Then
.Value = ""
.Validation.Add Type:=xlValidateList, _
Formula1:="Item 1,Item 2,Item 3,etc."
End If
End If
End With
End If
CleanUp:
Application.EnableEvents = True
End Sub

To install this event code, right click the worksheet tab and select View
Code from the popup menu that appears, then copy/paste the above code
into
the code window that appeared. That is it, change the value of A2 and
then
try entering things in A3.

--
Rick (MVP - Excel)


"Sloopy" wrote in message
...
There is a drop down list in A3 but the user should only choose from
the
drop
list in A3 if the value in A2 is greater than 0. If the value in A2 is
blank
then A3 should be blank and the user should not choose from the drop
down
list. I hope that makes more sense?

"Pete_UK" wrote:

I'm not sure what you want. Can't you just put a drop-down in cell A3?

Please try to explain more clearly what you have, what cells you are
using,
and what you want to achieve.

Pete

"Sloopy" wrote in message
...
Can you help me write an if statement: If A20 then the user must
choose
a
letter provided for them in a dropdown list in A3 otherwise A3 is
blank.






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
Adding the resulting intersection to an If statement. M.A.Tyler Excel Discussion (Misc queries) 1 June 16th 07 10:59 PM
HOW TO? Per choice in a list, certain cells become blacked out. LV Excel Discussion (Misc queries) 3 March 7th 07 09:27 PM
Creating a List based on your choice from Another List Cristi Excel Discussion (Misc queries) 1 August 14th 06 06:00 PM
Dropdown list/Multiple choice?? KDD Excel Discussion (Misc queries) 2 August 30th 05 09:28 AM
Can there be a third choice in an IF statement? kevin Excel Worksheet Functions 3 January 12th 05 08:51 PM


All times are GMT +1. The time now is 10:15 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"