DaveBlakeMAAT
Board Regular
- Joined
- Feb 28, 2016
- Messages
- 190
Hi all
Sorry I am probably being thick, but I am having a problem setting a variable based on a partial string within a cell.
It is giving me a syntax error which I suspect is due to the find statement.
My scenario is I have the following text string
"ACCOUNTING PERIOD 1 2016/2017 01-APR-2016 TO 30-APR-2016" in a cell
and I need to be able to extract the accounting period for 1 variable (which I have working using Trim(Mid(Range("A5"), 18, 2)), however I am struggling to extract the year for the 2nd variable.
Any ideas
Regards
Dave
Sorry I am probably being thick, but I am having a problem setting a variable based on a partial string within a cell.
Code:
AccountingYear = Trim(Mid("A5", Find("201", "A5", 1), 4))
It is giving me a syntax error which I suspect is due to the find statement.
My scenario is I have the following text string
"ACCOUNTING PERIOD 1 2016/2017 01-APR-2016 TO 30-APR-2016" in a cell
and I need to be able to extract the accounting period for 1 variable (which I have working using Trim(Mid(Range("A5"), 18, 2)), however I am struggling to extract the year for the 2nd variable.
Any ideas
Regards
Dave