#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default MACRO or FORMULA

I am trying to make a spread sheet which has a cell with a drop down function
from which a name can be selected - that is no problem.
What I would like to do is when a name is selected from the drop down, I
would like to have the cell below it self-populate with the time and date.
I have talked to many users much more experienced than I, and have not been
able to figure out a method to do this.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default MACRO or FORMULA

Right click on sheet tab, view code. Paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("A1") Then 'Range where drop down is
Range("A2").Value = Now 'Range where you want time stamp
End If
End Sub


Note that time stamp is changed whenever drop-down is changed. You may need
to adjust formatting of time stamp cell to match the exact look you are
wanting.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"CHENG28" wrote:

I am trying to make a spread sheet which has a cell with a drop down function
from which a name can be selected - that is no problem.
What I would like to do is when a name is selected from the drop down, I
would like to have the cell below it self-populate with the time and date.
I have talked to many users much more experienced than I, and have not been
able to figure out a method to do this.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default MACRO or FORMULA

Let's use Cells B9 and B10:

Put the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set b9 = Range("B9")
If Intersect(t, b9) Is Nothing Then Exit Sub
Application.EnableEvents = False
t.Offset(1, 0).Value = Now
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200840


"CHENG28" wrote:

I am trying to make a spread sheet which has a cell with a drop down function
from which a name can be selected - that is no problem.
What I would like to do is when a name is selected from the drop down, I
would like to have the cell below it self-populate with the time and date.
I have talked to many users much more experienced than I, and have not been
able to figure out a method to do this.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
lmb lmb is offline
external usenet poster
 
Posts: 6
Default MACRO or FORMULA

What would be used if data is entered in F1 then static date is posted in B2?

"Gary''s Student" wrote:

Let's use Cells B9 and B10:

Put the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set b9 = Range("B9")
If Intersect(t, b9) Is Nothing Then Exit Sub
Application.EnableEvents = False
t.Offset(1, 0).Value = Now
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200840


"CHENG28" wrote:

I am trying to make a spread sheet which has a cell with a drop down function
from which a name can be selected - that is no problem.
What I would like to do is when a name is selected from the drop down, I
would like to have the cell below it self-populate with the time and date.
I have talked to many users much more experienced than I, and have not been
able to figure out a method to do this.

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
Macro formula help El Bee Excel Worksheet Functions 5 October 20th 08 04:16 PM
Formula or Macro A.S. Excel Discussion (Misc queries) 6 March 5th 08 01:16 AM
Formula or Macro M Hebert Excel Discussion (Misc queries) 2 June 27th 07 01:24 PM
Formula Macro Secret Squirrel Excel Discussion (Misc queries) 7 January 27th 07 04:16 PM
Formula / Macro Help BSLAUTOMATION Excel Discussion (Misc queries) 3 August 31st 05 08:09 PM


All times are GMT +1. The time now is 12:47 AM.

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

About Us

"It's about Microsoft Excel"