+ Reply to Thread
Results 1 to 4 of 4

Adding Suffix to a date variable

  1. #1
    Registered User
    Join Date
    07-02-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    2

    Adding Suffix to a date variable

    Hello, i've recently learned VBA and really enjoying it. I've managed to automate a large proportion of my job with considerably more accuracy than when i was doing it manually, my manager doesn't know yet though so we'll keep that on the down low for a while. Anyway i've basically got the core part of my spreadsheet working well but am having trouble with adding suffix's (st, nd, rd, th) to a date function. The code i've put together can be seen below. Basically when i add a new sheet every week it copies the old one and corrects all the equations, which works fine, and then it adds week commencing and that Monday's date to a cell at the top, which also works fine. But no matter what I try I only get 'st' after the day number and this is the part I have the issue with. Can anyone have a go at correcting my code? Also, if you could explain why my code was going wrong that would be really helpful - always aiming to learn from my mistakes.

    Please Login or Register  to view this content.

    Thanks Andrew
    Last edited by malczyk; 07-03-2015 at 05:54 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Adding Suffix to a date variable

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    try one of the folloiwngs
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-02-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    2

    Re: Adding Suffix to a date variable

    Sorry about the code box I was unaware.

    The top one worked perfectly thanks.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Adding Suffix to a date variable

    You are welcome and thanks for the code tag.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Adding an ascending suffix
    By mxracer in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-03-2016, 06:35 AM
  2. Adding a suffix in series of numbers
    By HH61 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-05-2014, 12:38 PM
  3. [SOLVED] Adding Suffix to a cell value
    By AliiShariff in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2012, 09:04 AM
  4. [SOLVED] adding unique number suffix
    By hmm321 in forum Excel General
    Replies: 2
    Last Post: 07-01-2012, 05:25 PM
  5. Adding a suffix to a cell
    By darren1908 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-25-2008, 10:23 AM

Tags for this Thread

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