A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

change automatically a value when another cell value changes



 
 
Thread Tools Display Modes
  #1  
Old January 7th 05, 02:01 PM
CC
external usenet poster
 
Posts: n/a
Default change automatically a value when another cell value changes

I keep a list of students and activities. Because the number of students per
activity is limited, I would to track the date and time when they selected
their activity:
Student Activity Date
--------- -------- -----------
Smith Tennis 02/01/05

I would like the cells in the Date column to change automatically when the
Activity value is changed.
Thanks a lot,


Ads
  #2  
Old January 7th 05, 02:11 PM
Paul B
external usenet poster
 
Posts: n/a
Default

CC, here is one way using Worksheet_Change event

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'will put date & time in column C when something is put in B
If Target.Count > 1 Then Exit Sub
If Target.Column = 2 Then
Target.Offset(0, 1).Value = Now() 'change Now() to Date if you want the date
only
End If
End Sub

To put in this macro right click on the worksheet tab and view code, in the
window that opens paste this code, press Alt and Q to close this window and
go back to your workbook. If you are using excel 2000 or newer you may have
to change the macro security settings to get the macro to run. To change the
security settings go to tools, macro, security, security level and set it to
medium



"CC" > wrote in message
...
>I keep a list of students and activities. Because the number of students
>per
> activity is limited, I would to track the date and time when they selected
> their activity:
> Student Activity Date
> --------- -------- -----------
> Smith Tennis 02/01/05
>
> I would like the cells in the Date column to change automatically when the
> Activity value is changed.
> Thanks a lot,
>
>



  #3  
Old January 7th 05, 02:12 PM
Ron de Bruin
external usenet poster
 
Posts: n/a
Default

Hi CC

You can do it with the change event of the worksheet
This example will place the date/time in the B column if you change
a cell in the range A1:A20.

Place the code in the Sheet module

Right click on a sheet tab and choose view code
Paste the code there
Alt-Q to go back to Excel


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("a1:a20"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Format(Now, "mm-dd-yy hh:mm:ss")
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"CC" > wrote in message
...
>I keep a list of students and activities. Because the number of students
>per
> activity is limited, I would to track the date and time when they selected
> their activity:
> Student Activity Date
> --------- -------- -----------
> Smith Tennis 02/01/05
>
> I would like the cells in the Date column to change automatically when the
> Activity value is changed.
> Thanks a lot,
>
>



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change cell back color on click Dave Peterson Excel Discussion (Misc queries) 0 January 24th 05 10:50 PM
how do i make a date change automatically if i change one before . dpl7579 Excel Discussion (Misc queries) 1 January 11th 05 09:21 PM
How do I change the Cell color automatically in an Excel sheet wh. stump Excel Worksheet Functions 2 January 6th 05 02:14 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM
How to change (delivery) days and automatically the receive date in an other cell? Elboo Excel Worksheet Functions 5 November 22nd 04 02:44 PM


All times are GMT +1. The time now is 08:05 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 2004-2014 ExcelBanter.
The comments are property of their posters.