Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-01-2012, 08:23 AM
Bondai Bondai is offline Change format of date when using Now function in VB code Mac OS X Change format of date when using Now function in VB code Office for Mac 2011
Novice
Change format of date when using Now function in VB code
 
Join Date: Feb 2012
Posts: 3
Bondai is on a distinguished road
Exclamation Change format of date when using Now function in VB code

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


Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change format of date when using Now function in VB code VBA code to change carlleese24 Excel Programming 2 08-13-2011 09:48 AM
Change format of date when using Now function in VB code Today's Date Function freschij Excel 3 02-11-2011 10:21 AM
Automatic Date Function Corrupting Printer Output Theodulf Word 0 05-28-2010 12:33 PM
Date Function in word? aligahk06 Word 1 04-21-2010 06:33 AM
Change format of date when using Now function in VB code Imported message date change to today's date promark Outlook 1 12-23-2005 07:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft