+ Reply to Thread
Results 1 to 6 of 6

Dates

  1. #1
    Registered User
    Join Date
    07-18-2005
    Posts
    11

    Dates

    I am trying to select the date from Q2 and place that date in the header.

    How do i correct the statement below to make sure the date is captured as HDRDATE?

    Dim HDRDATE As Date
    Set HDRDATE.Value = ("Q2")

  2. #2
    ben
    Guest

    RE: Dates

    you are trying to treat HDRDATE as an object with the set statement. and you
    dimmed it as a value

    Dim HDRDATE As Date
    HDRDATE = range("Q2")

    --
    When you lose your mind, you free your life.


    "waynehinds" wrote:

    >
    > I am trying to select the date from Q2 and place that date in the
    > header.
    >
    > How do i correct the statement below to make sure the date is captured
    > as HDRDATE?
    >
    > Dim HDRDATE As Date
    > Set HDRDATE.Value = ("Q2")
    >
    >
    > --
    > waynehinds
    > ------------------------------------------------------------------------
    > waynehinds's Profile: http://www.excelforum.com/member.php...o&userid=25331
    > View this thread: http://www.excelforum.com/showthread...hreadid=388444
    >
    >


  3. #3
    Chip Pearson
    Guest

    Re: Dates

    Don't use the 'Set' keyword. 'Set' is used to assign an object to
    an object variable declared as the appropriate type.
    Change your code to

    HDRDATE = Range("Q2").Value


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "waynehinds"
    <[email protected]> wrote
    in message
    news:[email protected]...
    >
    > I am trying to select the date from Q2 and place that date in
    > the
    > header.
    >
    > How do i correct the statement below to make sure the date is
    > captured
    > as HDRDATE?
    >
    > Dim HDRDATE As Date
    > Set HDRDATE.Value = ("Q2")
    >
    >
    > --
    > waynehinds
    > ------------------------------------------------------------------------
    > waynehinds's Profile:
    > http://www.excelforum.com/member.php...o&userid=25331
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=388444
    >




  4. #4
    Registered User
    Join Date
    07-18-2005
    Posts
    11

    Thanks

    Thanks for replies..

    I want to now set this value to the date format "mm/dd/yy" and put in header.

    It is currently printing in header but it is printing m/d/yyyy

  5. #5
    ben
    Guest

    Re: Dates

    try

    HDRDATE = format(HDRDATE,"mm/dd/yy")

    --
    When you lose your mind, you free your life.


    "waynehinds" wrote:

    >
    > Thanks for replies..
    >
    > I want to now set this value to the date format "mm/dd/yy" and put in
    > header.
    >
    > It is currently printing in header but it is printing m/d/yyyy
    >
    >
    > --
    > waynehinds
    > ------------------------------------------------------------------------
    > waynehinds's Profile: http://www.excelforum.com/member.php...o&userid=25331
    > View this thread: http://www.excelforum.com/showthread...hreadid=388444
    >
    >


  6. #6
    Registered User
    Join Date
    07-18-2005
    Posts
    11

    Thanks

    Thanks a lot...That did it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1