Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question about date format... (VBA/Excel/2k)

    I'm using the following code to place the first three letter of a month and the last two numbers of the fiscal year into a range of cells. When I run this Excel makes the cell entry into a date: 6-JAN. I need it to be JAN 06. How can I fix this? Thanks.

    theYear = 2006

    For j = 1 To 12

    If j < 4 Then k = Right(theYear, 2) Else k = Right(theYear + 1, 2)

    partMonth = Left(UCase(MonthName(j)), 3) & " " & k

    With Range("a" & j + 12)
    .Value = partMonth
    .Font.Name = "Courier"
    End With

    Next

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Question about date format... (VBA/Excel/2k)

    try adding
    <code>.NumberFormat = "@"</code>
    just before the line
    <code>.Value = partMonth </code>

    StuartR

  3. #3
    2 Star Lounger
    Join Date
    Mar 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Question about date format... (VBA/Excel/2k)

    That worked. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •