Hi...I have a named ranged on my sheet that is called "UserTrafficPeriod"
It is a number cell but formatted "0000" - so if I enter 311, it is displayed as 0311 (meaning MARCH 2011).
This is a traffic period, and must be entered in this format.
Now in VBA I need to compare this traffic period to another cell.
To compare them directly I need to flip the year / date to ensure the <= compare works. But not sure how to do it in VBA. In formula I would do it like this :
=RIGHT(TEXT(UserTrafficPeriod,"0000"),2)&LEFT(TEXT(UserTrafficPeriod,"0000"),2)
Would give me the (logically correct) result of 1103 (without this I would be looking at 311 which is less than 1210, although this would not produce the desired result as they represent period)
But not sure on the VBA equivalent. Then could do a simple range("a1").value <= [VBA text bit goes here]
Any help appreciated!
It is a number cell but formatted "0000" - so if I enter 311, it is displayed as 0311 (meaning MARCH 2011).
This is a traffic period, and must be entered in this format.
Now in VBA I need to compare this traffic period to another cell.
To compare them directly I need to flip the year / date to ensure the <= compare works. But not sure how to do it in VBA. In formula I would do it like this :
=RIGHT(TEXT(UserTrafficPeriod,"0000"),2)&LEFT(TEXT(UserTrafficPeriod,"0000"),2)
Would give me the (logically correct) result of 1103 (without this I would be looking at 311 which is less than 1210, although this would not produce the desired result as they represent period)
But not sure on the VBA equivalent. Then could do a simple range("a1").value <= [VBA text bit goes here]
Any help appreciated!