Hi all
Searched for 2 hours yesterday and came up dry.
I need to convert January, February, etc to 01, 02 (2 digits), I can get single digits but not double.
Can anyone assist?
Thanks
Sean
Hi all
Searched for 2 hours yesterday and came up dry.
I need to convert January, February, etc to 01, 02 (2 digits), I can get single digits but not double.
Can anyone assist?
Thanks
Sean
You can format the cell with Number/Custom: 00 (double zero)
Hi
Thanks but I need to amend it through a variable.
If you explain what your doing and show how you are trying to do it maybe someone else could be of some help.
Source: http://stackoverflow.com/questions/1...me-into-numberPlease Login or Register to view this content.
Regards
Special-K
Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.
I need to convert the name of the month to a corresponding number, i.e. January will be 01, but I need the leading 0
Special-K = Legend
Thank u
To use the following function in your code just use something like:
activesheet.range("A1").value = convert_month("January")
This will return the string "01" which you can work with. Anyway, unless someone is actually typing in the month in this text-type way, you're better off using a formula like the following:
=IF(MONTH(A1)<10,CONCATENATE(0,MONTH(A1)),MONTH(A1))
Where "A1" is the range with an actual date in it.
Please Login or Register to view this content.
Sorry if this reply is a little cluttered.
Moderators note: code tags added for you - this time
Last edited by FDibbins; 04-19-2013 at 01:00 AM.
There are surely 100 ways to do this.
Please Login or Register to view this content.
Entia non sunt multiplicanda sine necessitate
@ crosservice, welcome to the forum
when you post VBA code, please use code tags, it makes it easier to read and understand - see my notes below on how to use them
1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
2. If your question is resolved, mark it SOLVED using the thread tools
3. Click on the star if you think someone helped you
Regards
Ford
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks