Hi guys
Can anyone advise how to change the format of a date automatically inserted via using the Now function in some VB code ?
Here is the code:
----------------------------
Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("H4:Q119")) Is Nothing Then Exit Sub
Application.EnableEvents = False
If Target.Interior.ColorIndex = xlNone Then
Target.Interior.ColorIndex = 3
Target = "X"
Range("U" & Target.Row) = "FAIL"
ElseIf Target.Interior.ColorIndex = 3 Then
Target.Interior.ColorIndex = 4
Target = "P"
Range("T" & Target.Row) = Now
Range("U" & Target.Row) = "PASS"
ElseIf Target.Interior.ColorIndex = 4 Then
Target.Interior.ColorIndex = xlNone
Target = ""
Range("T" & Target.Row) = ""
Range("U" & Target.Row) = ""
End If
Application.EnableEvents = True
Cancel = True
End Sub
----------------------------
Here is the date format I would like to use:
"dd/mm/yy - hh:mm"
(I have highlighted the area of code
(RED) where the date needs to change format).
This is bugging me totally and trying to search through the million threads about date functions is like looking for a needle in a haystack.
My lack of knowledge probably hindering the accuracy of my search.
Thanks
Bondai