#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Auto enter date


Please refer attachment. In the header row(A), amongst other, the dates
of the month appear. In the "Date Complete" column, I want the date
under which the status was changed to "Passed" to automatically appear
in this cell.


+-------------------------------------------------------------------+
|Filename: Batch Status Report.pdf |
|Download: http://www.excelforum.com/attachment.php?postid=5038 |
+-------------------------------------------------------------------+

--
Hennie
------------------------------------------------------------------------
Hennie's Profile: http://www.excelforum.com/member.php...nfo&userid=399
View this thread: http://www.excelforum.com/showthread...hreadid=561829

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Auto enter date


You need to paste this macro onto the appropriate sheet tab in the VBA
editor (e.g. Sheet1")

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 9 And Target = "Passed" And Target.Columns.Count = 1
And Target.Rows.Count = 1 Then
Cells(Target.Row, 5) = Date
End If
End Sub


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=561829

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Auto enter date


Martin,
Appreciate your quick response. May'be I must elaborate. The workbook
contains a spreadsheet for each month of the year and each spreadsheet
each date for the indivudual months. The "Passed" status can appear
under any of the dates for the months. The status is changed in the
individual cells based on the current status for a specific date.


--
Hennie
------------------------------------------------------------------------
Hennie's Profile: http://www.excelforum.com/member.php...nfo&userid=399
View this thread: http://www.excelforum.com/showthread...hreadid=561829

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Auto enter date


Sorry, should have read your question properly!

Try this

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Target.Columns.Count = 1 And Target.Rows.Count = 1 Then
If Target = "Passed" Then
Sh.Cells(Target.Row, 5) = Sh.Cells(1, Target.Column)
End If
End If
End Sub

It needs to go on the ThisWorkbook tab


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=561829

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Auto enter date


Martin, can you please elaborate on the location of the macro and also
if I can get it to run from a macro button?

Thanks,
Hennie


--
Hennie
------------------------------------------------------------------------
Hennie's Profile: http://www.excelforum.com/member.php...nfo&userid=399
View this thread: http://www.excelforum.com/showthread...hreadid=561829



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Auto enter date


If you open the VBA editor (ALT -F11), you will see a tab for
ThisWorkbook on the left hand side.

Paste the code into this sheet.

There is no need for a button as the macro will run every time a cell
is changed.

On reflection you need a slightly more elaborate version to avoid
problems when changing values in the first five columns

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Target.Columns.Count = 1 And Target.Rows.Count = 1 Then
If Target = "Passed" And Target.Column = 6 Then
Sh.Cells(Target.Row, 5) = Sh.Cells(1, Target.Column)
End If
End If
End Sub


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=561829

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
auto working week-ending date for timesheet Dm76 Excel Worksheet Functions 4 March 27th 06 10:21 PM
Excel: I enter date and format for date, but shows as number spohar Excel Discussion (Misc queries) 2 March 10th 06 08:40 PM
the auto date feature is not functioning properly - how to reset E. Ruth Cummins New Users to Excel 3 November 15th 05 02:31 AM
date auto change Colin2u Excel Discussion (Misc queries) 3 August 21st 05 05:26 AM
auto dating after entering the first date Jomo Watts Excel Worksheet Functions 2 April 5th 05 03:05 PM


All times are GMT +1. The time now is 06:05 PM.

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"