+ Reply to Thread
Results 1 to 2 of 2

trim year and default date

  1. #1
    Registered User
    Join Date
    11-26-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    95

    trim year and default date

    Hi, Im still learning VBA. I'm trying to trim a year built to only show numbers and then default to standard format. If the cell is blank, Also default to a standard format.

    The years I receive are

    > 1970
    1970
    1970s
    1970's

    I need to trim this to 1970.

    Once this is done. It needs to default to 31/12/9999 to "31/12/" & Year.Value

    If the Cell is blank then then default to 31/12/9999

    I tried building it up from scratch below but was getting bigger and messier as i kept trying to get around the debug.

    Also I am looking for a Similar code to the below to work for Postcodes.
    Looping through and only picking up the first letters e.g. CM15 8KL will be CM and W1 4KH will be W. - Should I set up a new thread for this one?


    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,411

    Re: trim year and default date

    [QUOTE]Also I am looking for a Similar code to the below to work for Postcodes.
    Looping through and only picking up the first letters e.g. CM15 8KL will be CM and W1 4KH will be W. - Should I set up a new thread for this one?/QUOTE]

    Google: excel vba code to validate uk post code

    If you don't get what you want from one of the links listed in Google, yes.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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. Replies: 3
    Last Post: 09-04-2013, 10:49 AM
  2. [SOLVED] Set Default Month and Year in a cell for entering date fields
    By kmahesh in forum Excel General
    Replies: 2
    Last Post: 07-26-2013, 11:17 PM
  3. Replies: 3
    Last Post: 08-14-2012, 05:14 AM
  4. date format default year
    By ken.land in forum Excel General
    Replies: 1
    Last Post: 08-09-2010, 02:38 PM
  5. Display 'Date' cell as blank instead of default year 1900
    By charger100 in forum Excel General
    Replies: 5
    Last Post: 11-19-2009, 05:21 PM

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