Excel macro time formatting

  Chris the Ancient 15:24 13 Nov 07
Locked

What little hair is left is fast disappearing!

I am using, as part of an Excel macro, a cell to show when the macro was run.

However, when I use the statement...

ActiveCell = Date & " " & Time
With Selection.Font
.Size = 9
.ColorIndex = 3
End With

... the cell gives me the date in dd/mm/yyyy hh:mm:ss format.

I would rather have dd/mm/yy hh:mm:ss as the format (takes kess room).

Despite trawling through various items in the help (help?) facility, I cannot really see how to do it.

I know it must be simple - so simple that I'm missing the bloomin' obvious!

So, can I have some sensible help please before my hairdresser loses my custom?

  Chris the Ancient 15:26 13 Nov 07

takes less room

  johnnyrocker 15:33 13 Nov 07

from reading your post it would appear the formula is giving you what you want?




johnny.

  Chris the Ancient 15:39 13 Nov 07

Pudgy fingers strike again!

I want dd/mm/yy (short year)

and

dd/mm/yy hh:mm (without the :ss)

I just KNEW that bit of code was getting to me!

  silverous 16:54 13 Nov 07

These do you ?

ActiveCell = Format(Now,"dd/mm/yy")

ActiveCell = Format(Now,"dd/mm/yy hh:mm")

  Chris the Ancient 17:15 13 Nov 07

Spot wottsit on!

I just knew that there had to be a simple solution!

Many thanks

CtA

This thread is now locked and can not be replied to.

Nintendo Switch review: Hands-on with the intuitive modular console and its disappointing games…

1995-2015: How technology has changed the world in 20 years

The updated 'Corel Painter inside Photoshop' plugin ParticleShop offers new brushes

New MacBook Pro 2017 release date, UK price and tech specs: Kaby Lake MacBook Pro to launch in…