+ Reply to Thread
Results 1 to 5 of 5

System Year on Macro

  1. #1
    Forum Contributor
    Join Date
    02-21-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    100

    System Year on Macro

    Hello,

    I've got a very quick question!

    I've got the following code, (working perfectly):
    Please Login or Register  to view this content.
    The codes works very well and generates the sheet correctly..

    Now what I want to do is... instead of having a box asking you to enter the current year, I want the macro to automatically take the year from the system date.

    Im sure it doesnt require a big change in the code..(at least I think so!)

    Any help would be appreciated!
    Thanks

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: System Year on Macro

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: System Year on Macro

    How about replacing all of that with:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Contributor
    Join Date
    02-21-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: System Year on Macro

    How do I link Yr to a cell instead? Instead of having Yr = Year (Date), can I just put:
    Yr = worksheetname!B5 ?

    If not, how do I link the year from a cell?

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: System Year on Macro

    If you create a sheet it's an empty sheet.
    Referring to an empty cell doesn't make much sense:

    Please Login or Register  to view this content.
    referring to an existing sheet containing a value in B5
    Please Login or Register  to view this content.



+ 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