Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Date Stamp in one cell when data in other range changes

Merged cells can cause lots of trouble--I try not to use them.

PYO1012 wrote:

Thank you, Dave, for responding! I tried exactly what you suggested
"..Offset(0, -2).value = "" " and that worked perfectly. Thank you, again!!

"Dave Peterson" wrote:

First, the code doesn't run when you start to change the cell--it fires when you
finish (hitting enter or tab or selecting another cell).

Which line causes the error?

Please share the exact details--addresses, values in the cells that are changing
and your keystrokes of what you're doing.

The only thing that I see that could be causing trouble is this line:

..Offset(0, -2).ClearContents

This will fail if that .offset(0,-2) cell is part of a merged set of cells.

If you're using merged cells, change this line to:

..Offset(0, -2).value = ""



PYO1012 wrote:

I have a question:

I've been using Dave's macro for a while now but there's one thing I wish I
could resolve...
The problem is a Debug error that occurs when I start to type in the cell
that triggers the timestamp but then decide to delete what I was typing and
leave the cell with no information. Is there something that can be added to
the following macro to have it keep the debug error from happening when I
leave the trigger cell blank after clicking in it?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("E11:E510"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, -2).ClearContents
Else
With .Offset(0, -2)
.NumberFormat = "hh:mm"
.Value = Time
End With
End If
Application.EnableEvents = True
End If
End With
End Sub

Any help would be appreciated!


--

Dave Peterson
.


--

Dave Peterson
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
Date stamp when a value is entered in a cell bbrant2 Excel Worksheet Functions 5 January 23rd 08 02:06 AM
Date stamp when a value is entered in a cell on another worksheet bbrant2 Excel Worksheet Functions 1 January 21st 08 05:27 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
How do I set an automatic date stamp into a cell in Excel? Nilla_Brown Excel Worksheet Functions 1 May 6th 05 06:18 PM
Setting up a date and time stamp in a cell Dave Peterson[_3_] Excel Programming 4 July 10th 03 01:53 PM


All times are GMT +1. The time now is 10:56 AM.

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"