Hi guys.

Need some help to change this code. What its doing now is getting a column with dates and another with the corresponding values and then sort it all by periods. The periods is when there is a difference of a day.
The problema is that in "BQ" gives me the oldest dates with the matching values and in "BS" gives me newest ones. The following columns sorts the other periods from the newest to the older(left to right).

What i need is that all of the periods appear from the oldest in "BQ" to the newest ones.
Here is the code:
Please Login or Register  to view this content.
This is one part of the code where i think the problema is. If you need all of it ill post it (its a bit long).

Thanks in advance.