Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Month and Day reverse in automatical recorded cell, STRANGE

Hi, I use Excel to track date when cell A1 have changed.

In followed codes, B1 are supposed to automatically record the date when I
changed content of A1. I use formula Month(B1) in C1 and Day(B2) in D1. It
works when I started in January, so when I made any change in A1 cell, B1
cell will automatically shows the Date when change happened(format of date is
'dd/mm/yyyy'), C1 cell will show month of date, D1 will show day of date.

----------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A1")) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, 1).Value = Format(Now, "dd/mm/yyyy")
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub
----------------------------------

it works.

THE strange thing happened in Feburay, when I made any change in cell A1,
the B1 show date in the format of ''mm/dd/yyyy", C1 show day instead of
month, D1 shows month instead of day.

Is there any suggestion? Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Month and Day reverse in automatical recorded cell, STRANGE

Try this variation

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A1")) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, 1).Value = Date
.Offset(0, 1).NumberFormat = "dd/mm/yyyy"
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"jiang" wrote in message
...
Hi, I use Excel to track date when cell A1 have changed.

In followed codes, B1 are supposed to automatically record the date when I
changed content of A1. I use formula Month(B1) in C1 and Day(B2) in D1.

It
works when I started in January, so when I made any change in A1 cell, B1
cell will automatically shows the Date when change happened(format of date

is
'dd/mm/yyyy'), C1 cell will show month of date, D1 will show day of date.

----------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A1")) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, 1).Value = Format(Now, "dd/mm/yyyy")
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub
----------------------------------

it works.

THE strange thing happened in Feburay, when I made any change in cell A1,
the B1 show date in the format of ''mm/dd/yyyy", C1 show day instead of
month, D1 shows month instead of day.

Is there any suggestion? Thanks in advance.



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
Default Cell format of existing Worksheets got changed automatical NGBalaji Excel Discussion (Misc queries) 1 May 21st 10 08:32 AM
automatical cell size adjusting ninjaneer Excel Discussion (Misc queries) 4 April 21st 08 10:13 PM
can a tab name/# chg. when a cell name/# chgs. automatical Excel LauryC Excel Worksheet Functions 1 November 12th 07 06:25 PM
Open a workbook with a name that was recorded in a cell emil Excel Programming 0 April 15th 06 12:23 AM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


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