+ Reply to Thread
Results 1 to 6 of 6

VBA Code to make two columns with dates the same

  1. #1
    Registered User
    Join Date
    04-28-2013
    Location
    Stockholm
    MS-Off Ver
    Excel 2007
    Posts
    93

    VBA Code to make two columns with dates the same

    Hi there,

    I attach the file I'm working with. It contains two columns with dates and I want to make them containing exactly the same values. For example, A22 = 01/02/2005 while there is no such date in column B. Hence, I want to delete this so 02/02/2005 comes up and it is equal to cell B22. Then it continues and we have a cell in column A with the date 14/03/2005 but it corresponds with 11/03/2005 on the same row in column B, therefore the cell in column B must be deleted until the two get equal and so on. I wrote the following code:

    Please Login or Register  to view this content.
    and it runs through the observations up to the beginning of 2006 when it can't go any further. I would greatly appreciate any suggestions on your side. Thank you! Dates.xlsx

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Code to make two columns with dates the same

    Probably not the most efficient but i am sleepy and it is what comes to the top of my mind:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: VBA Code to make two columns with dates the same

    Hi n_ant,
    try it
    Please Login or Register  to view this content.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code to make two columns with dates the same

    Hi n_ant,

    I'm not actually sure what you're trying to do but this works:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Registered User
    Join Date
    04-28-2013
    Location
    Stockholm
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: VBA Code to make two columns with dates the same

    Thank you all for your suggestions! That's awesome. Words can't express my gratitude

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code to make two columns with dates the same

    You're welcome and thanks for the rep!

+ 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. [SOLVED] How can I make this code shorter by using a loop. or there's any easier shorcuts code
    By romarkevinruiz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-10-2014, 08:53 AM
  2. Replies: 1
    Last Post: 08-14-2013, 12:01 PM
  3. How to make code look in other columns
    By Spark9871 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-06-2013, 03:56 PM
  4. [SOLVED] Code to look at 2 columns, one finding like value and the other evaluating Dates
    By mjfox52610 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-19-2013, 09:39 AM
  5. [SOLVED] [SOLVED] the dates on cell format make different dates.
    By date formats morph the dates/chang case in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 04-17-2005, 10:07 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