View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] sbitaxi@gmail.com is offline
external usenet poster
 
Posts: 158
Default Leading Zero for Long

On Oct 1, 2:36*pm, Joel wrote:
An input box is text. *so the best thing to do is to convert the date to
microsfot serial date and then format the date however you want. *the user
can input the date in any vaid date format they want. *For example

MyDate = inputbox("enter Date : "
SerialDate = DateValue(MyDate)
FormatDate = Format(SerialDate,"MMDDYY")

or for 4 digit year
FormatDate = Format(SerialDate,"MMDDYYYY")
or
FormatDate = Format(SerialDate,"MMMM DD, YYYY")

MM = 2 Digit month
MMM = 3 Character abbreviated Month
MMMM = Full Name of Month spelled out.

" wrote:
Hello:


I am using an inputbox to set a variable to a specific number and need
to preserve the leading zero because it affects an address reference
to a file I am trying to download.


It uses 2 digits for month and day, with a leading zero for single
digit months/days.


The macro prompts the User for the month they want to pull the report
for, then the day.


Your help is most appreciated.


Steven


Hi Joel:

The only reason I did it that way is because I need it formatted
YYYYMMDD. I also need to loop for a variable number of times,
essentially for every day in the date range. This is only intended to
be used for up to 1 full month. But it could also be used for as
little as 1 day.

My thought was to get the user to indicate the start date and end
date, then use the End Date to determine how many times the loop is
running. It is downloading CSV files from a server that generates one
every day, but does not have functionality to produce a consolidated
report for the entire month. We need the reports, but it is a huge
time waster to download them manually. The files are named using the
date format YYYYMMDD.

Thoughts?


Steven