Date problem

  • Thread starter Thread starter Monika
  • Start date Start date
M

Monika

Hi..

I have dates as "Mar-04","Apr-04","May-04","Jun-04". Which
are stored in cell as 3/1/2004, 4/1/2004,5/1/2004,6/1/2004.

How can i get values as it is in an variable (array)
rather than as dates. like if i get all these dates in an
array it finally gets converted in digit form ...3/1/2004
whereas in my variable I want Mar-04.

Thanks in advance
Monika
 
AFAIK, you'll have to loop through the range. One way would be to get
the .Text property:

Dim i As Long
Dim sArr(0 to 11) As String
For i = 0 To 11
sArr(i) = Range("A1").Offset(0, i).Text
Next i


You could also grab the values, then perform the conversion:

Dim i As Long
Dim vArr As Variant
vArr= Range("A1:L1").Value
For i = 1 To UBound(vArr, 2)
vArr(1, i) = Format(vArr(1, i), "mmm-yy")
Next i
 
hey thanks
it works wonderfully :-)
-----Original Message-----
AFAIK, you'll have to loop through the range. One way would be to get
the .Text property:

Dim i As Long
Dim sArr(0 to 11) As String
For i = 0 To 11
sArr(i) = Range("A1").Offset(0, i).Text
Next i


You could also grab the values, then perform the conversion:

Dim i As Long
Dim vArr As Variant
vArr= Range("A1:L1").Value
For i = 1 To UBound(vArr, 2)
vArr(1, i) = Format(vArr(1, i), "mmm-yy")
Next i


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top