Duplicate posting.
Duplicate posting.
Last edited by Logit; 03-19-2019 at 03:26 PM.
.
The following macro will successfully bring up the correct YEAR FOLDER and MONTH FOLDER if the month listed in L6 is a single digit ( Jan = 1; June = 6, etc.).
However, if the month is a double digit (Nov = 10; Oct = 11, Dec = 12), the macro fails.
Why and what change must be made to correct this error ?
The macro is currently set for the C DRIVE. In order to test there should be FOUR FOLDERS each named for a year : 2016, 2017, 2018, 2019Please Login or Register to view this content.
Each year folder should have a folder for each month: Jan, Feb, Mar, Apr, May, etc. etc. Three letter abbreviation only.
The attached workbook is already formatted (Sheet1, L6) properly. Enter a date in L6 (ex: 1/2/2016) and the macro will successfully open the year and
month folders. Enter a two digit month (ex: 11/15/2018) and the macro fails.
Why ??? What is the correction to the macro ?
If L6 contains a valid date usePlease Login or Register to view this content.
I don't know why it works at all. I would suggest working with the actual date instead of trying to parse it as a string:
Please Login or Register to view this content.
Hello Logit,
Hi Buddy, you have "Dim LValue As String" without using it in your Code?
Have you tried to Dim the LResult & LValue as Double?
Just guessing here.
Please consider:
Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .
Hello Logit,
I believe that 6StringJazzer might have provided a solution. Beats me how he could come up with such an idea.
@ 6StringJazzer,
How are you keeping my dear friend?
.
Hey all !! (and Winon too ... )
Thank you for the suggestions. Let me "ponder" on your solutions (I am certain they are correct).
Be right back ....
.
Yes ... your suggestions are 'dead on'. Thank you all for your assistance.
Winon: the ""Dim LValue As String"" was something left over from a previous attempt at failing.
I figure by the time I finally go home, I might learn enough here to actually write some code ! And it will
be all because of you guys.
Thanks again !!!!!
You are welcome Logit,
Glad we could assist, and thank you for the Rep+. I appreciate it.
Kind regards.
Thanks for the rep
Having seen 6Stringjazzer' reply I realised I mucked up, the month part of the first formula shouldn't be there.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks