+ Reply to Thread
Results 1 to 2 of 2

Macro to delete certain columns and delete rows based on time in another column

  1. #1
    Registered User
    Join Date
    04-18-2012
    Location
    indiana, usa
    MS-Off Ver
    Excel 2010
    Posts
    35

    Macro to delete certain columns and delete rows based on time in another column

    I am trying to create a macro to delete rows that do not fall between the hours of 9am to 6pm in column J. The time format in that column is "2:11:00 AM". So only rows with times of "9:00:00 AM" to "6:00:00 PM" would be left. Once that is done, the macro would delete the following columns C, D, E, Columns G thru U, and W - AB. This sounds super complicated, but would greatly appreciate the help!

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,637

    Re: Macro to delete certain columns and delete rows based on time in another column

    Perhaps a macro like this?

    Please Login or Register  to view this content.
    This assumes that your time values starts in cell J2. If not so change to appropriate value.

    I've only deleted columns L to U in the second step. You wanted columns G to U. If so you would also delete all values in column J where the AM / PM time values are kept.

    Finally deleting columns C to E will "move" the J column with AM / PM values to column J


    Alf

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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