Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default auto updating cell values


Hello all,

I am having a bit of a problem trying to figure out how to write thi
code.
Basically, I have in Cell A1 a value (ie 100) and cell A2 is a dro
down
validation box with 2 possible responses (YES & NO). What I need is
code,
that will automatically update the value of A1 if cell A2 is set t
YES.
It's a count of what is left.

ie. A1 = 100 and you select YES for A2, then A1 needs to update to 9

(A1.value - 1), but if A2 is NO, then no change is made to A1.

Any help provided will be greatly appreciated!!

Thoma

--
dok11
-----------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...fo&userid=1058
View this thread: http://www.excelforum.com/showthread.php?threadid=26123

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default auto updating cell values

Thomas,
Paste the following code in the code pane for the worksheet (press ALT+F11
in Excel and click on Sheet1 in the VB Project Explorer):

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("B1").Address Then
If Target.Value = "YES" Then
If Not Range("A1") <= 0 Then Range("A1") = Range("A1").Value - 1
End If
End If
End Sub

This should do it.
Good luck.
E. Froma
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
cell auto-updating TechGuy[_2_] Excel Worksheet Functions 4 March 30th 09 04:55 PM
Updating an Auto-Filter depending on cell value JAbels001 Excel Worksheet Functions 5 January 9th 09 10:14 PM
Cell formula not updating, auto calc on, over 100 sheets mcphc Excel Discussion (Misc queries) 1 June 15th 06 04:03 PM
Cell showing the time auto updating M. Neves Excel Discussion (Misc queries) 3 February 23rd 06 01:30 PM
auto updating cell values dok112[_26_] Excel Programming 0 September 17th 04 06:28 PM


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