Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SERIAL number of date (2000 sr 1)

    I have this line of code:
    Sheets("L0848").Range("G" & Trim(Str(cont))).Value = var_SCAD

    how to have in Sheets("L0848").Range("P" & Trim(Str(cont))).Value the date in serial number
    Example:
    in G have 29/03/2006
    in P i want 38805


    tks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SERIAL number of date (2000 sr 1)

    Sheets("L0848").Range("P" & cont) = Sheets("L0848").Range("G" & cont)

    Make sure that column P is formatted as General, not as a date.

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: SERIAL number of date (2000 sr 1)

    If you format P as general and use:

    Sheets("L0848").Range("P" & cont).value = Sheets("L0848").Range("G" & cont).value2

    it should do what you want.

    One issue I have seen with what Hans suggested (using the "Value" from G) is that excel may format the cell automatically to a date. Using the Value2 property will put the serial number in directly and excel will not reformat the display.

    Steve

Posting Permissions

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