time stamp vba to date stamp

Vtookup

Board Regular
Joined
May 30, 2017
Messages
137
Office Version
  1. 2016
  2. 2013
Hi. I need help to place date stamp (S3) if next cell (T3) is not blank. then continue down the column.
Attached is a functional time stamp vba. i follow this vba to get a date stamp 07/04/18. no Date was registered.
I replaced line 3's Range & line 5's range and time format to "Date"
i have vba for column "T". Column "S" is my problem.
any help is much appreciated. Thank you.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("T3:T50")) Is Nothing Then
If Target.Count = 1 Then _
Range("S" & Target.Row) = Date
End If
Application.EnableEvents = True
End Sub
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
what is the issue this code works ...

you need to paste this code to sheet window.(if do ALT+F11 , you will see module, thisworkbook and sheet1 , sheet2 and sheet3 generally)
 
Upvote 0
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim rInt          As Range
  Dim cell          As Range

  Set rInt = Intersect(Target, Range("T3:T50"))
  If Not rInt Is Nothing Then
    Application.EnableEvents = False
    For Each cell In rInt.Cells
      If IsEmpty(cell.Value) Then
        cell.Offset(, -1).ClearContents
      Else
        cell.Offset(, -1).Value = Date
      End If
    Next cell
    Application.EnableEvents = True
  End If
End Sub
The code must go in the sheet module; right-click the tab of interest, select View Code, and paste it there.
 
Upvote 0
MUKESHY12390,
thanks for the reply.
i did try to run it and without error but i can't see the date display in column Y
if "T3" is not empty, "S3" will have the date display.right?
Thanks

 
Upvote 0
Hi Shg.
Thanks for the code, I'm not good with vba. necessity drives me to learn to interpret the language.
If i may ask, where is column "S", is it "cell.Offset(, -1)"? Well, Still no display of date.
i'm running 3 codes here. private sub as the third, clear cell second and transfer data to anoither cell ("T3") as first.
i use CALL " "() in two vba. IS this the problem? thanks.
 
Upvote 0
Hi Shg.
Thanks for the code, I'm not good with vba. necessity drives me to learn to interpret the language.
If i may ask, where is column "S", is it "cell.Offset(, -1)"? Well, Still no display of date.
i'm running 3 codes here. private sub as the third, clear cell second and transfer data to anoither cell ("T3") as first.
i use CALL " "() in two vba. IS this the problem? thanks.
The code works fine here. As I said, it MUST go in the sheet module.

Not knowing what your other code is doing, I don't have another suggestion. Maybe you could take the other code out for now and try it.
 
Upvote 0
where is column "S", is it "cell.Offset(, -1)"?
Yes, it's one cell to the left of column T. It could instead be written as

Code:
      If IsEmpty(cell.Value) Then
        Cells(cell.Row, "S").ClearContents
      Else
        Cells(cell.Row, "S").Value = Date
      End If
 
Upvote 0
@ shg,
I'm also confused why it acted this way. no error when i run them.
anyway i can always use formula for that. but the problem is how to convert today's date into static date? maybe you could help?
or just ^: Thanks for your help. i'll get back to this. I'll recheck.
 
Upvote 0
I'd use the code as posted.

Maybe you could put the workbook on box.net and post a link.
 
Upvote 0
Hi Shg
at time we become careless with our work and the mind stuck and become desperate.
a day off from work give your mind rest and clarity. that is what happen here. forgot i added a column.
so
Code:
[COLOR=#333333]If IsEmpty(cell.Value) Then[/COLOR]        cell.Offset(, -1).ClearContents
      Else
        cell.Offset(, -1).Value = Date [COLOR=#333333]      End If[/COLOR]
should be -2. now it's working. Sorry, My bad.
Thank You for your help.
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,991
Members
452,541
Latest member
haasro02

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top