Updating a cell with data validation when another cell is changed.

In my sheet I have cell Y2, which when it contains "y", I want it to
update the validation list

=IF(Y2="y",DogList,NAList)

That works, but if i delete the "y" from cell Y2, the validation drop-
down list doesn't change until I click onto the cell

I wrote some code to try and work around this:

Private Sub WorkSheet_Change(ByVal Target As Range)
Application.Calculation = xlCalculationManual
If Target.Address = "Y2" Then Range("AJ2").Value = ""
Application.Calculate
End Sub



But still doesn't do that I want, when I change the value of Y2,
nothing is updated until I actually click on the sell.
0
myvetmeds (3)
9/7/2010 1:54:00 PM
excel 39879 articles. 2 followers. Follow

6 Replies
644 Views

Similar Articles

[PageSpeed] 46

I don't understand.

You have to click on the cell to see the dropdown and then use the dropdown 
arrow to see the list, right?

If you want the value in the cell with the data|validation to change (to 
empty???) when you change the value in Y2, then you should be able to use a 
worksheet_change event.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

     If Intersect(Target, Me.Range("y2")) Is Nothing Then
         Exit Sub
     End If

     Me.Range("j2").Value = ""

End Sub



On 09/07/2010 08:54, my wrote:
> In my sheet I have cell Y2, which when it contains "y", I want it to
> update the validation list
>
> =IF(Y2="y",DogList,NAList)
>
> That works, but if i delete the "y" from cell Y2, the validation drop-
> down list doesn't change until I click onto the cell
>
> I wrote some code to try and work around this:
>
> Private Sub WorkSheet_Change(ByVal Target As Range)
> Application.Calculation = xlCalculationManual
> If Target.Address = "Y2" Then Range("AJ2").Value = ""
> Application.Calculate
> End Sub
>
>
>
> But still doesn't do that I want, when I change the value of Y2,
> nothing is updated until I actually click on the sell.

-- 
Dave Peterson
0
petersod1 (224)
9/7/2010 2:28:24 PM
ps.  I'm not sure why you're messing with the .calculation setting, but any 
range.address is going to look like:  $X$99 (you're missing the dollar signs) in 
your line of code.

You could use:

if target.address(0,0) = "Y2" then
The 0's (or False's) mean that you want the relative address (without the $'s).

Personally, I like to use the intersect() check.  I find it easier to update and 
less things to worry about -- $'s and uppercase and multiple cells, for example.

On 09/07/2010 08:54, my wrote:
> In my sheet I have cell Y2, which when it contains "y", I want it to
> update the validation list
>
> =IF(Y2="y",DogList,NAList)
>
> That works, but if i delete the "y" from cell Y2, the validation drop-
> down list doesn't change until I click onto the cell
>
> I wrote some code to try and work around this:
>
> Private Sub WorkSheet_Change(ByVal Target As Range)
> Application.Calculation = xlCalculationManual
> If Target.Address = "Y2" Then Range("AJ2").Value = ""
> Application.Calculate
> End Sub
>
>
>
> But still doesn't do that I want, when I change the value of Y2,
> nothing is updated until I actually click on the sell.

-- 
Dave Peterson
0
petersod1 (224)
9/7/2010 2:31:18 PM
Can I explain a little clearer

1)Change Y2 to "y"
2)Go to AJ2, choose an appropriate value e.g. "Accessories" from the
"DogsList" NameList

Fine, data is valid

3)I delete "y" from Y2
4)AJ2 is still displaying the value "Accessories"

Data is no longer technically valid

So I want it to refresh the if statement, which should change AJ2 back
to "NAList". It wont do that until I move over to AJ2 and go to click
the drop down list.

0
myvetmeds (3)
9/7/2010 3:03:00 PM
Changing the value in Y2 won't change the value in any other cell.  You'll need 
that worksheet_change event to do that.



On 09/07/2010 10:03, my wrote:
> Can I explain a little clearer
>
> 1)Change Y2 to "y"
> 2)Go to AJ2, choose an appropriate value e.g. "Accessories" from the
> "DogsList" NameList
>
> Fine, data is valid
>
> 3)I delete "y" from Y2
> 4)AJ2 is still displaying the value "Accessories"
>
> Data is no longer technically valid
>
> So I want it to refresh the if statement, which should change AJ2 back
> to "NAList". It wont do that until I move over to AJ2 and go to click
> the drop down list.
>

-- 
Dave Peterson
0
petersod1 (224)
9/7/2010 3:45:55 PM
On Sep 7, 4:45=A0pm, Dave Peterson <peter...@XSPAMverizon.net> wrote:
> Changing the value in Y2 won't change the value in any other cell. =A0You=
'll need
> that worksheet_change event to do that.
>
> On 09/07/2010 10:03, my wrote:
>
>
>
> > Can I explain a little clearer
>
> > 1)Change Y2 to "y"
> > 2)Go to AJ2, choose an appropriate value e.g. "Accessories" from the
> > "DogsList" NameList
>
> > Fine, data is valid
>
> > 3)I delete "y" from Y2
> > 4)AJ2 is still displaying the value "Accessories"
>
> > Data is no longer technically valid
>
> > So I want it to refresh the if statement, which should change AJ2 back
> > to "NAList". It wont do that until I move over to AJ2 and go to click
> > the drop down list.
>
> --
> Dave Peterson

Dave,

So the code I have written should work? It doesn't seem to.
Any suggestions would be appreciated.
0
myvetmeds (3)
9/8/2010 9:02:36 AM
Just the same suggestions that are in the earlier responses.

On 09/08/2010 04:02, my wrote:
> On Sep 7, 4:45 pm, Dave Peterson<peter...@XSPAMverizon.net>  wrote:
>> Changing the value in Y2 won't change the value in any other cell.  You'll need
>> that worksheet_change event to do that.
>>
>> On 09/07/2010 10:03, my wrote:
>>
>>
>>
>>> Can I explain a little clearer
>>
>>> 1)Change Y2 to "y"
>>> 2)Go to AJ2, choose an appropriate value e.g. "Accessories" from the
>>> "DogsList" NameList
>>
>>> Fine, data is valid
>>
>>> 3)I delete "y" from Y2
>>> 4)AJ2 is still displaying the value "Accessories"
>>
>>> Data is no longer technically valid
>>
>>> So I want it to refresh the if statement, which should change AJ2 back
>>> to "NAList". It wont do that until I move over to AJ2 and go to click
>>> the drop down list.
>>
>> --
>> Dave Peterson
>
> Dave,
>
> So the code I have written should work? It doesn't seem to.
> Any suggestions would be appreciated.

-- 
Dave Peterson
0
petersod1 (224)
9/8/2010 11:48:06 AM
Reply:

Similar Artilces:

Disabling Tracking changes
Our management team would like to know if there is a official document from Microsoft that states that Microsoft Word Tracking Changes Features can be completly turned off or not. thanks Turn on change tracking On the Review tab, in the Tracking group, click the Track Changes image. To add a track changes indicator to the status bar, right-click the status bar and click Track Changes. Click the Track Changes indicator on the status bar to turn Track Changes on or off. Note If the Track Changes command is unavailable, you might have to turn off document protection....

what command shifts all cells in a column up or down?
Accidentally did something in an Excel worksheet to shift all cells in a particular column down. Do not know the command(s) or keystrokes to reverse what I did and shift all cells in the column up. select the inserted cell Edit>Delete when asked, click "Shift cells up" -- Kind regards, Niek Otten "marco" <marco@discussions.microsoft.com> wrote in message news:C0CAFF80-291E-4A62-9D52-980D94F74378@microsoft.com... > Accidentally did something in an Excel worksheet to shift all cells in a > particular column down. Do not know the command(s) or keystrokes...

Problem with Script Updating
I am using a script to update the “1099 Type” field for Master Vendor table. The script basically is a basic if-then statement. This script is run “Before Document Commit” and it’s not updating correctly, its flip-flopping the results. When the script is set to run Before Document Commit I have the “Destination mapping” field “1099 Type” set to “Use Script”. Script below: If SourceFields("Send 1099") = "N" Then DestinationFields("Options.1099 Type").Value = 1 Else DestinationFields("Options.1099 Type").Value = 4 End If I have also tried this s...

Cell Editing Macro
I am looking for a way to edit a cell and put quotation marks around the contents of that cell using a macro (or some way of automating this). The reason being that this file is being imported into another program and the syntax requires quotation marks around each value. The original file is comma delimited and the contents are both numbers and words. Any help towards a solution is greatly appreciated. thanks Tyler mcleant at hotmail dot com Styler, Try writing the file with the Text Write program at www.tushar-mehta.com. It has an option to put all fields in quotes. -- Regards fro...

Report problem
I have this report that shows all receipts from any given client. The total outstanding balance is then tallied in the report. For some, the total outstanding balance is $0. In this case, I don't want that person to show up in the report. Is there a way to omit them? I know I could do it it in the underlying query, but the only way I know to do it requires totaling everything in the query, which would eliminate the ability to show each receipt individually on the report. Thanks! Create a totals query that calculates the balance by client. Then add this totals query to your re...

Changes to Security Settings
In order to efficiently lock users out of entry and access screens, it would be EXTREMELY helpful if we could sort through the windows based on key words or functionalities. I'd like to see this done over all modules and series. The functionality of the security screen is very poor and could use a lot of work. I know that advanced security is suppose to help the process, but from everything I've seen, it's just a pretty gui that has the same limitations as the original security screen. With Sarbanes Oxley compliance in affect, security is a big issue. Please consider ...

Update for MS Money 2005?
I have Money 2005. Is there an update to MS Money for Canadian users? Thanks in advance for any answers. We need a bit more information! Are you having problems with M2005 or is this just a post-Christmas/New Year random query when you are trying to get away from the in-laws? -- Regards Bob Peel, Microsoft MVP - Money For unofficial FAQs see http://money.mvps.org/ or http://umpmfaq.info/ I do not respond to any emails that I have not specifically asked for. "Daniel" <Daniel@discussions.microsoft.com> wrote in message news:E86EAB89-21DE-4505-ACAD-647278D736BD@microso...

updating sheets based on data in first sheet
Another payroll question, I have a workbook that contains 26 sheets, one for each bi-weekl payroll period. I would like to set it up so when i add a new employe the rest of the sheets also update automatically with that employee name and information. I have been able to acheive this to a limited degree using th =sheet1!a1 formula, but this only updates the info in the first cel and particularly the first column. I would like to acheive this using the first sheet, since at th end of the year I would like to be able to calculate ytd figure easily. Thank -- Message posted from http://www.Exc...

Publisher 2007 and Microsoft Updates
I created a newsletter yesterday - everything fine - use Publisher all the time. Then an automatic update came down this morning and I can't open the file - it says "Publisher cannot open file" Other documents in Publisher are opening - any ideas? http://support.microsoft.com/kb/972566/ -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "Kim" <Kim@discussions.microsoft.com> wrote in message news:8754339B-99DC-4D09-83AD-6B34D8215274@microsoft.com... >I created a newsletter yesterday - everythin...

Microsoft Update only updates Windows Defender
iacrosoft Update only updates Windows Defender - I have to use Belarc Advisor to get a list of missing updates, and then go to the Microsoft Download Center to search for the missing updates and download and install them one at a time. I have Windows XP Home SP3, with Microsoft Update set to automatic download - can anyone tell me why I do not get all the necessary upadtes? Is this a sudden, new problem? When was Automatic Updates last working? Can you update manually via http://windowsupdate.microsoft.com? Any chance you've got a beta build of WinXP SP3 installed? What...

Data not being saved
Form is based on a combobox that pulls 1000s of records. The combobox record source is a query that is based on customer numbers. The form does not consistently save changes to records. However, if the same form is modified to pull only a single record (i.e., not based on a combobox of 1000s) then changes are saved. How are you making "changes to records" ... i.e., to more than one record at a time? Usually, a form displays a single record, and Access saves the changes when instructed, or when another record is called up. Regards Jeff Boyce Microsoft Office/Access MVP &...

Outlook data file check
Hello, I am using Outlook 2007 on XPSP2. Quite often on startup I get a message the Outlook is doing a file check and performance may be slow. I also often get on computer startup a message requesting me to send an error report to Microsoft that includes a few episodes of Outlook not responding. Any idea what this could be about and how to prevent both? -- Thanks, Bob ...

is there an easy way to move parts of cells around
we have an excel sheet which is keeping track of dart player team points over a four week competition. Each week the couple (one guy and one girl) compete in a dart tournament, to hopefully win and get the most points. Second place comes with less points, third has less again, and so on. In order to use "sum" we have entered the information along one row. Now when it is finished, we would like a quick and easy way to have the two player who played together to be placed one under the other. For example Billy-Joe Beckett would end up in one cell and Debralee would be in the cell direct...

Update question
Soory if this is the wrong place to ask this, but cannot find a NG proper to Windows 7. I currently run Windows Vista and am getting tired of Vista's decision to tell me that it is going to shut down in less than a minute. So have decided to upgrade to Windows &. I note that I can purchase an upgrade versiom for 64 quid from Amazon or an apparently full version of Windows 7 Home premium for 89 quid. My question is this - If I buy the upgrade version will I only be able to load it on a new PC in the future if I already have windows Vista installed? i.e For any future cl...

Outlook 2003 died mysteriously after update
Setup in a nutshell... System: Lenovo T500 laptop OS: Vista Business SP1 32-bit Software: Office Outlook 2003 SP3 Problem... So I'm using this setup for over a year, everything OK. Yesterday I did two things and now Outlook dies (quietly, sans error message) immediately after startup. It show the splash screen, displays my inbox, and *poof* disappears. What I did earlier... 1. Windows Update installed: KB9766662, KB979306, KB979099, KB975929 2. At the same time, while searching for another program to uninstall I stumbled upon (and uninstalled) Windows LIVE Toolbar and...

Excel cells changes number format automatically
I am using Excel 2007. Many of the cells I am working on are in general format where I store various numbers for analysis. These values change itself to date format occassionally creating whole lot of work for me to change them back to general format. How can I solve this issue? Also in my pivot table, my source data is in general format. Still when I click on sub total in any catagory in the table to find details about it, formats are changed date format in the new sheet it pops up. Can someone help resolve this issue. ...

Merge into same document using different data sources
I have a template file that I use as a mailer. Each week I set up my merge fields and merge from an excel data file. The following week I want everything to look exactly the same but want to merge from a different excel list. I open the publication, tell it to proceed without connection to the datasource (my old list), choose tools, mail merge, use an existing list ... and all of my perfectly placed merge fields disappear! So every time I want to use another list I have to put my merge fields in again. My headers are the same in every excel file so mapping should not be a problem. ...

How update entity in post update?
I created a handler for Update post callout for Opportunity. I want update some fields of the opportunity on the PostUpdate. However, if I call the Update method of CRMOpportunity in the PostUpdate I will create a recursive post callout. Can somebody help me? Thank you for pay attention []'s Vin�cius Pitta Lima de Ara�jo You need to check the OrigObjectXML field to see what fields were updated and then act appropriately. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------------------------------------- On Wed, 4 Aug 2004 17:43:17 -0300, "Vin�cius ...

Counting cells with a specific background colour
I have a spreadsheet with several rows. The background of the rows can either be coloured Red, Orange, Green or white. What I want to do is have a running total for each colour, so that if a row is set with a green background it will increment the Green total by one. If an Orange row is changed to Red, the Orange count will drop by one, and the Red count will go up by one. Is this possible, and if so, how? Rgds Duncan One way: Assuming that the colors aren't applied by Conditional Formatting: http://cpearson.com/excel/colors.htm If they are applied by CF, do a conditional...

Outlook Change Account Problem
The one is driving me nuts. When I set up another Pop3 account, the user information I entered, (specifically: Your Name) was entered incorrectly. I had tested it with the test function button and it worked just fine; both user name and address were sent through. I even sent an e-mail from that account to another, still OK. OK, so now I want to correct the name, but Outlook refuses to change it. I have tried deleting that account, all accounts, and deleting associated registry entries for that account, etc. No dice. The old name still appears in the message. Is there some hidden setti...

Cannot install update KB979906 for .NET Framework 1.1 SP1
Running : Windows XP media center edition SP3 Have tried installing KB979906 a few times and also downloaded update manually but cannot install this update. Receiving error 0x643.Is it safe to uninstall the .NET Framework 1.1 and re-install as possibly corrupt , without having to uninstall/re-install all other .NET frameworks 2 , 3 and 3.5 including the updates that go with them? .. Hello sherlockomes, you might want to look at the following kb article to see if this will help with the error 80070643. <http://windows.microsoft.com/en-US/windows-vista/Windows-Update-error...

When cells with dates don't format
I have some cells which contain dates. These dates are a link from another data source (Bloomberg) and when I try to formatt the cells, I cannot. They will only display the date in mm/dd/yyyy formatt. Any ideas? Thanks My first guess is that the cells are coming in as text. Look for an apostrophe (" ' ") in front of the data in the cell. If not, try using "text to columns" (select the entire column, click Data, Text to Columns, Finish). Then, attempt to re-format the cells (or entire column) as a date with the form that you want. Also, make sure ...

latest update too MSCFV2
Hi, I have MSCFV2 version 6.5.7825.0. Could someone inform me if this is the latest download? Looks like you have 6.5.7825.0 from 05/21/2006, but there is a newer version - 6.5.7831.0 from 06/01/2006. C. Smith Enso Technologies, Incorporated http://www.ensotech.com On Tue, 13 Jun 2006 04:25:02 -0700, Paul <Paul@discussions.microsoft.com> wrote: >Hi, > >I have MSCFV2 version 6.5.7825.0. Could someone inform me if this is the >latest download? Christopher Smith csmith@ensotech.com Enso Technologies, Incorporated http://www.ensotech.com Also - meant to post this in t...

Print record once, update Yes/No field verifiying print
I would like to print a group of records, then have a Yes/No field [Printed] updated in my Jobs table with an update query showing the records were printed. Then next time the report runs, In my query criteria I will test for True values on the Yes/No field. Then only the records with the Yes/No field marked No will print. Any suggestions? Thanks Tommyboy,there's more to this question than meets the eye. For an explanation of what's involved, see: Has the record been printed? at: http://allenbrowne.com/ser-72.html The article includes a free sample database that dem...

Change xlstart path
Is there a way to change the path of the xlstart folder , so that it points to a network path. I know there is an alternate startup path but that is for XL templates. I need to point to a macro , so that the macro starts up when opening excel. Hope this makes sense. I wouldn't change this setting (even if I knew how). And I wouldn't want you to change it for me, either. Have you thought of just telling people to install an addin: tools|addins and point to that network workbook Craig wrote: > > Is there a way to change the path of the xlstart folder , so that it points ...