View Single Post
  #3   Report Post  
taimysho0 taimysho0 is offline
Junior Member
 
Posts: 10
Default

Quote:
Originally Posted by Claus Busch View Post
Hi,

Am Mon, 3 Mar 2014 21:09:34 +0000 schrieb taimysho0:

I have exported a data set to an excel file and i am trying to write a
macros that will convert the data in the cell into a date format, and
then use these dates to plot data points on a line graph. For example in
my attachment, the first cell has data of 120304-000564. The part i need
converted is the first half before the hyphen which is 120304. this
should translate into 2012-03-04. The first two digits represents the
year, followed by month and day. The second half of the numbers after
the hyphen can just be removed.


try:

Sub Test()
Dim LRow As Long

LRow = Cells(Rows.Count, 2).End(xlUp).Row
Range("B3:B" & LRow).TextToColumns Destination:=Range("B3"), _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, Other:=True, _
OtherChar:="-", FieldInfo:=Array(Array(1, 5), Array(2, 9)), _
TrailingMinusNumbers:=True
End Sub


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
thanks so much for your help! now that i have these in date format, do you know how i can do a count of all dates that are the same so i can plot them in a graph? for example all dates that are 3/4/2012, count them together, and use that number as the data plot and the date of 3/4/12 as the x axis on the graph?