I want to be able to extract dates (where excel recognizes it as a date) from a string.
Here are some samples:
From JAN-01-2011 To JAN-15-2011
From JAN-01-2010
it will always be in one of those two formats but the dates will change.
I want to be able to extract dates (where excel recognizes it as a date) from a string.
Here are some samples:
From JAN-01-2011 To JAN-15-2011
From JAN-01-2010
it will always be in one of those two formats but the dates will change.
Here is one way to find the three dates.![]()
Please Login or Register to view this content.
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
![]()
Please Login or Register to view this content.
snb,
That works great!! You are the man. I just need to do three other things with it:
1) They need to be saved in two separate variables
2) They need to be in date format
3) It also needs to work if the sting only has one date in it (like the example I gave) - I think this one, I can just use part of davegugg's code but if you can think of a more efficient way, then I am all ears.
btw, davegugg thank you for your help too. I appreciate everyone's help. And you gave me a few ideas as well.
Last edited by djblois1; 07-15-2011 at 01:19 PM.
Here is what I have so far:
I need to do 3 things with this code now:![]()
Please Login or Register to view this content.
1) They need to be saved in two separate variables
2) They need to be in date format
3) It also needs to work if the sting only has one date in it (like the example I gave)
The code I posted was already set up to do those three things:
![]()
Please Login or Register to view this content.
Thank you - it actually works great. Quick question:
does this:
mean that I can use a stra(0), Stra(1), and a Stra(2)?![]()
Please Login or Register to view this content.
if so why didn't you use:
Can I use that for any variable?![]()
Please Login or Register to view this content.
It declares the variable as an array with three members. I really only needed two. You can easily find more info on vba arrays by doing a quick Google search. You could also set up the date variable as an array.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks