Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional date stamp?


I am looking for an event macro that will place a date in column B onl
when the letter "R" is placed in column A. Is this possible?

Thanks for any replies

--
CJ-2
-----------------------------------------------------------------------
CJ-22's Profile: http://www.excelforum.com/member.php...fo&userid=1755
View this thread: http://www.excelforum.com/showthread.php?threadid=52508

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Conditional date stamp?

Su

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If .Column = 1 Then
If .Value = "R" Then
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy"
Application.EnableEvents = False
.Value = Date
Application.EnableEvents = True
End With
End If
End If
End With
End Sub


If you want to include lowercase r's, substitute the line

If UCase(.Value) = "R" Then

In article ,
CJ-22 wrote:

I am looking for an event macro that will place a date in column B only
when the letter "R" is placed in column A. Is this possible?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional date stamp?


Thanks JE McGimpsey, it works great. I have two additional questions.

1) Can this be modified so that if I delete the "R" the date will als
delete?

2) Can this be modified to work in different columns if needed?

Thanks again

--
CJ-2
-----------------------------------------------------------------------
CJ-22's Profile: http://www.excelforum.com/member.php...fo&userid=1755
View this thread: http://www.excelforum.com/showthread.php?threadid=52508

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Conditional date stamp?

1)

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(.Cells, Range("A:A")) Is Nothing Then
Application.EnableEvents = False
If .Value = "R" Then
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy"
.Value = Date
End With
ElseIf Len(.Text) = 0 Then
.Offset(0, 1).ClearContents
End If
Application.EnableEvents = True
End If
End With
End Sub

2) Change "A:A" to your desired columns, e.g.:

If Not Intersect(.Cells, Range("J:J")) Is Nothing Then

or

If Not Intersect(.Cells, Range("A:A,J:J")) Is Nothing Then

In article ,
CJ-22 wrote:

1) Can this be modified so that if I delete the "R" the date will also
delete?

2) Can this be modified to work in different columns if needed?

Thanks again.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional date stamp?


Outstanding! That works great. Thanks so much JE McGimpsey

--
CJ-2
-----------------------------------------------------------------------
CJ-22's Profile: http://www.excelforum.com/member.php...fo&userid=1755
View this thread: http://www.excelforum.com/showthread.php?threadid=52508



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional date stamp?

Would there be a way to add a date stamp to a saved file through a
script? Such as <worksheetname_<todaysdate.xls?

CJ-22 wrote:
I am looking for an event macro that will place a date in column B only
when the letter "R" is placed in column A. Is this possible?

Thanks for any replies.


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
Separating date from a Date & Time stamp JT Excel Discussion (Misc queries) 9 June 10th 08 05:55 PM
Conditional Time-Stamp Ed Excel Discussion (Misc queries) 0 October 19th 06 10:40 PM
Create a button that will date stamp todays date in a cell Tom Meacham Excel Discussion (Misc queries) 3 January 11th 06 01:08 AM
conditional formatting & time stamp Alib Excel Discussion (Misc queries) 2 December 29th 05 08:07 PM
Date stamp spreadsheet in excel to remind me of completion date Big fella Excel Worksheet Functions 1 October 18th 05 04:10 PM


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