DavidSCowan
Board Regular
- Joined
- Jun 7, 2009
- Messages
- 78
Could someone help me please.
Below is an example entry in a single cell. I am parsing the different elements out into separate columns.
16 Aug Payment to xxx Type of payment yyy Amount £zzz<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
The first stage is to extract the date and using Instr etc. I end up with the date in Column 1 and the rest of the string in Column 2:
16 Aug Payment to xxx Type of payment yyy Amount £zzz<o></o>
<o></o>
So far so good, but the problem is that Excel insists on date formatting the 16 Aug as date but I want it as text. Excel enters 16 Aug as 16-Aug i.e. putting in a hyphen (and underneath it has entered 16/08/2011). As it happens in my data the 16 Aug date is for another year but Excel, trying to be helpful, presumes it must be 2011 which it isn’t.
Could someone please tell me how in the macro I format the 16 Aug as text?
After the macro has run I can format the column as text using TEXT(A1,"ddmmm") etc. but how do I do it in the macro?<o></o>
I have a related question to this regarding the vba Intellisense and why it can’t give me guidance in this case. Why is it that when the full stop is inserted after EntireColumn in the line of code Range("A1:A1").EntireColumn. I am offered options. But when I type Range("A1:A1").text or Range("A1:A1").numberformat. I am not? Does anybody know?
Thank you in advance.
PS I am using Windows 7 and Office 2007
Below is an example entry in a single cell. I am parsing the different elements out into separate columns.
16 Aug Payment to xxx Type of payment yyy Amount £zzz<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
The first stage is to extract the date and using Instr etc. I end up with the date in Column 1 and the rest of the string in Column 2:
16 Aug Payment to xxx Type of payment yyy Amount £zzz<o></o>
<o></o>
So far so good, but the problem is that Excel insists on date formatting the 16 Aug as date but I want it as text. Excel enters 16 Aug as 16-Aug i.e. putting in a hyphen (and underneath it has entered 16/08/2011). As it happens in my data the 16 Aug date is for another year but Excel, trying to be helpful, presumes it must be 2011 which it isn’t.
Could someone please tell me how in the macro I format the 16 Aug as text?
After the macro has run I can format the column as text using TEXT(A1,"ddmmm") etc. but how do I do it in the macro?<o></o>
I have a related question to this regarding the vba Intellisense and why it can’t give me guidance in this case. Why is it that when the full stop is inserted after EntireColumn in the line of code Range("A1:A1").EntireColumn. I am offered options. But when I type Range("A1:A1").text or Range("A1:A1").numberformat. I am not? Does anybody know?
Thank you in advance.
PS I am using Windows 7 and Office 2007