+ Reply to Thread
Results 1 to 4 of 4

DATEVALUE problem

  1. #1
    Registered User
    Join Date
    11-02-2010
    Location
    Cambridge,UK
    MS-Off Ver
    Excel 2003
    Posts
    4

    DATEVALUE problem

    A macro contains this which works:

    Please Login or Register  to view this content.
    but using a variable for the year does not work:

    Please Login or Register  to view this content.
    Any suggestions?
    Last edited by DonkeyOte; 11-04-2010 at 03:35 AM. Reason: tags

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: DATEVALUE problem

    Try
    Please Login or Register  to view this content.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: DATEVALUE problem

    First off - please always use CODE tags even for one liners.

    Quote Originally Posted by camlad View Post
    ...using a variable for the year does not work:

    Yearx = InputBox("Enter diary year as 'YYYY'", "Diary year")
    Cells(Rowx, 1).FormulaR1C1 = "=DATEVALUE(RC[2]&""-""&RC[1]&""-"" & Yearx)"

    Any suggestions?
    Your quotations are slightly awry

    Please Login or Register  to view this content.
    It would also be better to use Application.InputBox so as to restrict entry to numbers (then conduct further tests to ensure valid/reasonable value)

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-02-2010
    Location
    Cambridge,UK
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: DATEVALUE problem

    Thanks to Dave and you, DonkeyOte - all's well

+ 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