Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 7th, 2008, 08:39 PM
Authorized User
 
Join Date: Jun 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mona_upm84
Default Select date from cell with m/d/yyyy h:mm format

Hi all,

I need some help about my new task... I need to transfer whole column A of Sheet 1 into column A of Sheet 2. The problem is all data in Column A Sheet 1 is formatted as "m/d/yyyy h:mm".

For example for A1(Sheet1) = 07/06/2008 5:30:00 AM.
And I need this information (only time which is 5:30:00 AM) to be print at A1(Sheet 2). Somebody help me.....

Regards,
Mona

 
Old August 8th, 2008, 01:20 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi Mona

Can you try the following?

Sub DFormat()


Sheets(2).Range("A1").Value = Format(Sheets(1).Range("A1").Value, "h:mm AM/PM")

End Sub

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old August 10th, 2008, 05:58 PM
Authorized User
 
Join Date: Jun 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mona_upm84
Default

Thanks Shasur,

It work!!! it helps lots.... thank you :D






Similar Threads
Thread Thread Starter Forum Replies Last Post
Date dd-mm-yyyy John2112 SQL Server 2000 2 March 16th, 2007 05:15 AM
Converting short date to show mm/dd/yyyy crabjoe Access 4 March 7th, 2007 03:46 AM
YYYY and MM in access' SQL select statement Condor76 Access VBA 1 February 15th, 2006 02:47 PM
Date formats... dd/mm/yyyy SeanW Classic ASP Databases 3 June 14th, 2004 12:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.