tim_chamberlain
asked on
Find closest date in sorted vba collection
Hello,
I have a sorted Collection containing dates (Excel VBA). I need to find the closest date in the collection to a date 12 months prior to the current date. Although the data is in a collection it can be put into another object such as an Array if that makes more sense to do this.
I'd appreciate any thoughts on the best way to do this.
Thanks.
I have a sorted Collection containing dates (Excel VBA). I need to find the closest date in the collection to a date 12 months prior to the current date. Although the data is in a collection it can be put into another object such as an Array if that makes more sense to do this.
I'd appreciate any thoughts on the best way to do this.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi
90 Do While ie.busy Or Not ie.ReadyState = IE_READYSTATE.Complete: DoEvents: Loop
htmlStr = ie.document.body.innerHTML
pointer = InStr(1, htmlStr, "Future Events")
pointer = InStr(pointer, htmlStr, "vAlign")
htmlStr = Mid(htmlStr, pointer + 18, 9)
Range("B5").Value = htmlStr
100 Set doc = ie.document
The additional lines between 90 & 100 passed the test on your first sample (A5), did not test it further, but I think it should work for all.
90 Do While ie.busy Or Not ie.ReadyState = IE_READYSTATE.Complete: DoEvents: Loop
htmlStr = ie.document.body.innerHTML
pointer = InStr(1, htmlStr, "Future Events")
pointer = InStr(pointer, htmlStr, "vAlign")
htmlStr = Mid(htmlStr, pointer + 18, 9)
Range("B5").Value = htmlStr
100 Set doc = ie.document
The additional lines between 90 & 100 passed the test on your first sample (A5), did not test it further, but I think it should work for all.
Apologies, wrong question, disregard my comment.
ASKER