+ Reply to Thread
Results 1 to 4 of 4

Changing URL based on date

  1. #1
    Registered User
    Join Date
    06-25-2014
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    17

    Angry Changing URL based on date

    Hello. I'm trying to figure out how to have VBA return the value of the following month in mm format (i.e. 08 for August, not 8), based on today's date. As such, today it being the 7th month, I wish to return the value 08 (the 8th month).

    I need the URL of

    Please Login or Register  to view this content.
    To essentailly be

    Please Login or Register  to view this content.
    but the way in which I have posted it above does not work!

    Also, I need to define it such that as the month in question (in this example 08) will rename the subsequent part of the URL (here, August). So for example, next month (August), the URL should automatically become

    Please Login or Register  to view this content.
    If anyone knows how I could set this problem up in VBA i would really appreciate any help you could lend!

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Changing URL based on date

    format(month(date)+1,"00")

    What happens in december though?
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    06-25-2014
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Changing URL based on date

    Quote Originally Posted by nathansav View Post
    format(month(date)+1,"00")

    What happens in december though?
    Thanks that formatting works! For December I would just need to to set it up something like this?

    Please Login or Register  to view this content.
    Would that work? Also, do you know how I can set up a variable for the text month (AUGUST here), so that If Month(MyDate)=7, then MONTHNAME(or whatever the variable is called)=AUGUST?

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Changing URL based on date

    format(dateserial(year(date),month(date)+1,1),"mmmm")

    something like that.

    I dont think you can assign a 0 to a date, i'd put mydate=dateserial(year(date)+1,1,1), 1st of Jan next year.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Changing a date based on a parameter
    By cpots13 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-12-2013, 06:55 PM
  2. trying to auto populate based of changing a date
    By grenes in forum Excel General
    Replies: 1
    Last Post: 06-21-2011, 06:17 PM
  3. Excel 2007 : Returning Value Based on Changing Date
    By aram87 in forum Excel General
    Replies: 2
    Last Post: 02-11-2010, 04:46 AM
  4. Changing cell contents based on date.
    By SteelySteve in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-11-2008, 10:06 PM
  5. changing text color based on date
    By misty0705 in forum Excel General
    Replies: 2
    Last Post: 04-27-2007, 03:29 PM

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