Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old November 30th 04, 02:55 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Sep 2006
Posts: 148
Default why my date shows up as 12:00:00 AM?

The following code works - except when I query the intermediate window for
?begbase, I get "12:00:00 AM" and I don't understand why. Any help would be
much appreciated.


Public reviewbeg As Date
myfilename = InputBox("What will this file be named?")

ActiveWorkbook.SaveAs (myfilename)
Range("a2").Select
Selection.CurrentRegion.Select

Set myrange = Range("a2").CurrentRegion
Set daterange = myrange.Offset(, myrange.Columns.Count).Resize(1, 1)
daterange.Select

reviewbeg = InputBox("What date (MM/DD/YYYY) will mark the beginning of
the review period?")
ActiveCell.FormulaR1C1 = reviewbeg
ActiveCell.NumberFormat = "m/d/yy h:mm;@"

daterange.Name = "begrevdate"
daterange.Offset(2).Name = "begbase"
daterange.Offset(2).FormulaR1C1 =
"=date(YEAR(begrevdate)-1,month(begrevdate),day(begrevdate))"


  #2   Report Post  
Old November 30th 04, 03:16 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2003
Posts: 2,337
Default why my date shows up as 12:00:00 AM?

Instead of
reviewbeg = InputBox("What date (MM/DD/YYYY) will mark the beginning of
the review period?")
ActiveCell.FormulaR1C1 = reviewbeg
ActiveCell.NumberFormat = "m/d/yy h:mm;@"

Wouldn't this be easier. BTW. for the current year just use m/d

Sub putdate()'Excel should automatically format as date
ActiveCell = InputBox("Enter Date mm/dd/yyyy")
End Sub

--
Don Guillett
SalesAid Software

"Papa Jonah" wrote in message
...
The following code works - except when I query the intermediate window for
?begbase, I get "12:00:00 AM" and I don't understand why. Any help would

be
much appreciated.


Public reviewbeg As Date
myfilename = InputBox("What will this file be named?")

ActiveWorkbook.SaveAs (myfilename)
Range("a2").Select
Selection.CurrentRegion.Select

Set myrange = Range("a2").CurrentRegion
Set daterange = myrange.Offset(, myrange.Columns.Count).Resize(1, 1)
daterange.Select

reviewbeg = InputBox("What date (MM/DD/YYYY) will mark the beginning

of
the review period?")
ActiveCell.FormulaR1C1 = reviewbeg
ActiveCell.NumberFormat = "m/d/yy h:mm;@"

daterange.Name = "begrevdate"
daterange.Offset(2).Name = "begbase"
daterange.Offset(2).FormulaR1C1 =
"=date(YEAR(begrevdate)-1,month(begrevdate),day(begrevdate))"



  #3   Report Post  
Old November 30th 04, 03:38 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 27,285
Default why my date shows up as 12:00:00 AM?

I ran your code answering 12/15/2003 then did:

? Range("begbase").Value
12/15/2002


--
Regards,
Tom Ogilvy

"Papa Jonah" wrote in message
...
The following code works - except when I query the intermediate window for
?begbase, I get "12:00:00 AM" and I don't understand why. Any help would

be
much appreciated.


Public reviewbeg As Date
myfilename = InputBox("What will this file be named?")

ActiveWorkbook.SaveAs (myfilename)
Range("a2").Select
Selection.CurrentRegion.Select

Set myrange = Range("a2").CurrentRegion
Set daterange = myrange.Offset(, myrange.Columns.Count).Resize(1, 1)
daterange.Select

reviewbeg = InputBox("What date (MM/DD/YYYY) will mark the beginning

of
the review period?")
ActiveCell.FormulaR1C1 = reviewbeg
ActiveCell.NumberFormat = "m/d/yy h:mm;@"

daterange.Name = "begrevdate"
daterange.Offset(2).Name = "begbase"
daterange.Offset(2).FormulaR1C1 =
"=date(YEAR(begrevdate)-1,month(begrevdate),day(begrevdate))"





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date shows as a number Bob[_16_] Excel Discussion (Misc queries) 1 June 7th 11 09:03 PM
blank date shows up as s 1/0/00 Mary Excel Worksheet Functions 2 July 17th 08 12:00 AM
Excel: I enter date and format for date, but shows as number spohar Excel Discussion (Misc queries) 2 March 10th 06 08:40 PM
Date shows as 01/01/00 Kmagg Excel Discussion (Misc queries) 2 September 23rd 05 11:51 PM
date shows 1/1/1900 CycloneGD Excel Worksheet Functions 2 August 24th 05 03:45 PM


All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright 2004-2017 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"

 

Copyright © 2017