LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Macro Question

Absolutely Perfect!!! Thanks.

Rob

"Sandy" wrote:

If I read your post you want the date in column "i"? if so here is a
mod otherwise you'll need to change the column letter in the "cells"
statements

Place in the sheet level module


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:H12")) Is Nothing Then
Application.EnableEvents = False
If Not IsEmpty(Target.Value) Then
' change if column wrong
With Cells(Target.Row, "i")
.Value = Now()
.NumberFormat = "dd mmm yyyy hh:mm:ss"
End With
Else
' change if column wrong
Cells(Target.Row, "i").ClearContents
End If
End If
Application.EnableEvents = True
End Sub

Sandy

Rob wrote:
I know very little about VBA coding. I found an event macro in another
thread on this board to enter a date/time stamp in a cell when a chanage was
made in a range of cells. The code was written for a range that was a single
column and used .offset(0,1) to determine where the date was entered (see the
macro below). I am trying to modify this macro for a three demensional range
(a1:h12) and want the date to be stored in the same row as the active cell
but in column I. I am sure this is a simple change but it is beyond my
knowlege - any help?

The following is the macro I am trying to modify:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("A2:A10"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 1).ClearContents
Else
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub

Rob



 
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
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
MACRO QUESTION Eddy Stan Excel Worksheet Functions 2 February 28th 06 01:08 PM
Macro Question sony654 Excel Worksheet Functions 3 February 27th 06 09:55 PM
Macro question Terry Bennett Excel Worksheet Functions 9 January 22nd 06 10:39 PM
Macro question SJC Excel Programming 11 March 23rd 05 10:37 PM


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