Date Question

  • Thread starter Thread starter Bob Myers
  • Start date Start date
B

Bob Myers

Could use a little help.

I have the date '1/20/08' in a cell displayed as '20 Jan' using NumberFormat
= "dd mmm". Is there a way in VBA to get the '20 Jan' in a string so that I
can concatenate it with some other text?

Thanks.
Bob Myers
 
Bob,

Date in A1, other text in A2, try this

Range("A3").Value = Format(Range("A1").Value, "dd mmm") & " " &
Range("A2").Value

Mike
 
Sub getdate()
Dim MyDate
MyDate = Format(Range("a1").Value, "dd-mmm")
MsgBox MyDate
Range("b1").Value = MyDate & " It Worked"
End Sub

Vaya con Dios,
Chuck, CABGx3
 
Try This formula =TEXT(B11,"DD MMM") &", " &C11
where B11 is the cell containing Date and C11 is the Text
 
Could use a little help.

I have the date '1/20/08' in a cell displayed as '20 Jan' using NumberFormat
= "dd mmm". Is there a way in VBA to get the '20 Jan' in a string so that I
can concatenate it with some other text?

Thanks.
Bob Myers

Several ways illustrated below:
================================
Option Explicit
Sub foo()
With [a1]
.Value = DateSerial(2008, 1, 20)
.NumberFormat = "dd mmm"
Debug.Print (.Value)
Debug.Print (.Text)
Debug.Print (Format(.Value, "dd mmm"))
End With
End Sub
================================
--ron
 
Back
Top