Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I hope this helps
Sub Get_MnDt() Dim sMonth, sDate As Integer sMonth = InputBox("Enter the month in numeeral (mm) format") sDate = InputBox("Enter the date in numeeral (dd) format") MsgBox "Output String = " & Format(sMonth, "00") & Format(sDate, "00") & vbNewLine & _ "Use the code : Format(sMonth, " & Chr(34) & "00" & Chr(34) & ") & Format(sDate, " & Chr(34) & "00" & Chr(34) & ") " End Sub - selva v pasupathy for more codes and examples visit http://socko.wordpress.com... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo | Excel Discussion (Misc queries) | |||
Long Long Long Nested If Function | Excel Discussion (Misc queries) | |||
Interrupting long calculations in Excel? Hi all, I am having a verylong calculation in Excel using VBA. Of course I know I can hit ESC orCTRL+BREAK to interrupt the VBA program. But I found due to too long runningprocess, the Excel window stop to | Excel Discussion (Misc queries) | |||
Clearing cells takes long, long time | Excel Discussion (Misc queries) | |||
Clearcontents takes long, long, time | Excel Programming |