+ Reply to Thread
Results 1 to 10 of 10

Macro to remove items after date and then convert date tormat dd/mm/yyy

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,873

    Macro to remove items after date and then convert date tormat dd/mm/yyy

    I have data that is imported


    I need code to remove the data including the space after the dates, and to convert to date format dd/mm/yyyy for eg 2022.06.21 K1 -K1 to be removed and date to be converted to 21/06/2022


    Your assistance in this regard is most appreciated
    Last edited by Howardc1001; 08-03-2022 at 12:00 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: Macro to remove items items date and then convert date tormat dd/mm/yyy

    Howard,
    An alternative to VBA in this case is Power Query

    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,873

    Re: Macro to remove items items date and then convert date tormat dd/mm/yyy

    Thanks for the help Alan, but I am not very familiar with Power Query , which I need to learn

    I would prefer VBA code

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Macro to remove items after date and then convert date tormat dd/mm/yyy

    Hi Howard,

    Try this code ...
    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  5. #5
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,873

    Re: Macro to remove items after date and then convert date tormat dd/mm/yyy

    Many thanks for the help, nsnkw83


    Your code works 100%

  6. #6
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Macro to remove items after date and then convert date tormat dd/mm/yyy

    I have just noticed a small mistake !
    Please Login or Register  to view this content.
    Thanks for the Rep+

  7. #7
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,873

    Re: Macro to remove items after date and then convert date tormat dd/mm/yyy

    Thanks for the updates code. For some unknown reason your old code worked

  8. #8
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Macro to remove items after date and then convert date tormat dd/mm/yyy

    I will work but might not give the correct results if the length of the date is not the same - i.e. it is searching for the first space so if the date is written as 2022.06.9 S1 instead of 2022.06.21 S1 it might error out

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

    Re: Macro to remove items after date and then convert date tormat dd/mm/yyy

    Quote Originally Posted by Howardc1001 View Post
    I need code to remove the data including the space after the dates, and to convert to date format dd/mm/yyyy for eg 2022.06.21 K1 -K1 to be removed and date to be converted to 21/06/2022
    simply
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,873

    Re: Macro to remove items after date and then convert date tormat dd/mm/yyy

    Thanks for the help Jindon

+ 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: 1
    Last Post: 12-22-2020, 04:52 AM
  2. Replies: 2
    Last Post: 10-22-2015, 03:36 PM
  3. Replies: 1
    Last Post: 04-01-2015, 03:06 PM
  4. Macro to convert date range to individual line items (i.e. rows) in excel
    By violetmind in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-11-2014, 09:53 PM
  5. Remove Unused Items in Date Filter
    By chronofreak in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 02-26-2014, 12:31 PM
  6. Excel Macro to send notification email when items pass a certain date
    By Krist87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-08-2014, 09:08 AM
  7. Macro to remove items from spreadsheet
    By kuijo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-25-2007, 08:58 AM

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