I have data that I extract from a website which has several hundred rows of data. Most of the dates look fine, but there are several at the end, which are different from the others.
When I do a =TYPE Function I find the last few rows that the problem is occuring in are number while the rest is text. It also occurs whenever there are not 10 digits in the date Ex. 6/10/2009. As we can see there is no 0 in front of the 6. It should read 06/10/2009, but isn't and thus my VBA code is having difficulties along with the formatting being off.
When I do a format of the dates to "dd/mm/yyyy" so that I may present all of the data in one unique format, the data switches. So for example, a date that is 10/01/2009 is formatting to 01/10/2009 which is incorrect. Is there any way that I could potentially change the type of any number to text format and then switch to "dd/mm/yyyy" format without it changing the month on me. Perhaps, based on the data in the previous rows if a majority of the month's is "10" then it will place 10 in the mm and not change to "01" as in the example.
Here is some sample data:
Oct KY Detail
<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 11pt; FONT-FAMILY: Calibri,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 105px"><COL style="WIDTH: 64px"></COLGROUP><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD> </TD><TD>A</TD><TD>B</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">315</TD><TD style="TEXT-ALIGN: right">15/10/2009</TD><TD>Sale</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">316</TD><TD style="TEXT-ALIGN: right">15/10/2009</TD><TD>Sale</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">317</TD><TD style="TEXT-ALIGN: right">9/10/2009</TD><TD>Accrued Interest</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">318</TD><TD style="TEXT-ALIGN: right">9/10/2009</TD><TD>Income</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">319</TD><TD style="TEXT-ALIGN: right">8/10/2009</TD><TD>Accrued Interest</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">320</TD><TD style="TEXT-ALIGN: right">8/10/2009</TD><TD>Income</TD></TR></TBODY></TABLE>
<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 11pt; FONT-FAMILY: Calibri,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 75px"><COL style="WIDTH: 110px"></COLGROUP><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD> </TD><TD>A</TD><TD>B</TD></TR><TR style="HEIGHT: 55px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">1</TD><TD style="TEXT-ALIGN: right">10/09/2009</TD><TD>Accrued Interest</TD></TR><TR style="HEIGHT: 55px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">2</TD><TD style="TEXT-ALIGN: right">10/09/2009</TD><TD>Income</TD></TR><TR style="HEIGHT: 55px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</TD><TD style="TEXT-ALIGN: right">10/08/2009</TD><TD>Accrued Interest</TD></TR><TR style="HEIGHT: 55px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</TD><TD style="TEXT-ALIGN: right">10/08/2009</TD><TD>Income</TD></TR></TBODY></TABLE>
The first data set has the first two rows in the format they should be. This is for October data. However, the next 4 rows are slightly different. They exclude the 0 before the date and they are =TYPE (1) number. When my VBA runs, the date switches to the month becoming 09/10 or 08/10. This is not what I want.
Is there any way that I can counteract this from occurring? I cannot control the data that I download from a bank however I need it in a specific date format of "dd/mm/yyyy" so that I may import it into my accounting system.
If you need the VBA code to help piece this together, just let me know.
Thanks in advance!
When I do a =TYPE Function I find the last few rows that the problem is occuring in are number while the rest is text. It also occurs whenever there are not 10 digits in the date Ex. 6/10/2009. As we can see there is no 0 in front of the 6. It should read 06/10/2009, but isn't and thus my VBA code is having difficulties along with the formatting being off.
When I do a format of the dates to "dd/mm/yyyy" so that I may present all of the data in one unique format, the data switches. So for example, a date that is 10/01/2009 is formatting to 01/10/2009 which is incorrect. Is there any way that I could potentially change the type of any number to text format and then switch to "dd/mm/yyyy" format without it changing the month on me. Perhaps, based on the data in the previous rows if a majority of the month's is "10" then it will place 10 in the mm and not change to "01" as in the example.
Here is some sample data:
Oct KY Detail
<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 11pt; FONT-FAMILY: Calibri,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 105px"><COL style="WIDTH: 64px"></COLGROUP><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD> </TD><TD>A</TD><TD>B</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">315</TD><TD style="TEXT-ALIGN: right">15/10/2009</TD><TD>Sale</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">316</TD><TD style="TEXT-ALIGN: right">15/10/2009</TD><TD>Sale</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">317</TD><TD style="TEXT-ALIGN: right">9/10/2009</TD><TD>Accrued Interest</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">318</TD><TD style="TEXT-ALIGN: right">9/10/2009</TD><TD>Income</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">319</TD><TD style="TEXT-ALIGN: right">8/10/2009</TD><TD>Accrued Interest</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">320</TD><TD style="TEXT-ALIGN: right">8/10/2009</TD><TD>Income</TD></TR></TBODY></TABLE>
<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 11pt; FONT-FAMILY: Calibri,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 75px"><COL style="WIDTH: 110px"></COLGROUP><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD> </TD><TD>A</TD><TD>B</TD></TR><TR style="HEIGHT: 55px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">1</TD><TD style="TEXT-ALIGN: right">10/09/2009</TD><TD>Accrued Interest</TD></TR><TR style="HEIGHT: 55px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">2</TD><TD style="TEXT-ALIGN: right">10/09/2009</TD><TD>Income</TD></TR><TR style="HEIGHT: 55px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</TD><TD style="TEXT-ALIGN: right">10/08/2009</TD><TD>Accrued Interest</TD></TR><TR style="HEIGHT: 55px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</TD><TD style="TEXT-ALIGN: right">10/08/2009</TD><TD>Income</TD></TR></TBODY></TABLE>
The first data set has the first two rows in the format they should be. This is for October data. However, the next 4 rows are slightly different. They exclude the 0 before the date and they are =TYPE (1) number. When my VBA runs, the date switches to the month becoming 09/10 or 08/10. This is not what I want.
Is there any way that I can counteract this from occurring? I cannot control the data that I download from a bank however I need it in a specific date format of "dd/mm/yyyy" so that I may import it into my accounting system.
If you need the VBA code to help piece this together, just let me know.
Thanks in advance!