+ Reply to Thread
Results 1 to 8 of 8

VB Code to delete certain rows and columns

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to delete certain rows and columns

    Hello:

    Please refer to attached file.
    I have data as shown.
    I need VB Code to do the following...
    Delete rows 17,18,20,21,23,24 and so on
    Basically delele all rows except 19,22,25 and so on.
    Also delete columns B,C,E,H,J,K,M,P,Q,S,T,U,W,Z

    Let me know if you have any questions.
    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VB Code to delete certain rows and columns

    Try the attached.
    Attached Files Attached Files
    Last edited by AB33; 11-13-2016 at 09:52 AM.

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to delete certain rows and columns

    Hello AB33:

    You got it correct, however the pattern to delete rows needs to follow all the way down.
    Please let me know if you have any questions.
    Thanks.

    Riz

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VB Code to delete certain rows and columns

    See if this works
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to delete certain rows and columns

    Hi AB33:

    Did not work, please refer to attached sheet.
    Thanks
    Riz
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VB Code to delete certain rows and columns

    See the result sheet. You should be on the active sheet when you run the code.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to delete certain rows and columns

    Hi AB33:

    Seems to work, will test further and let you know if any Q
    Thanks
    Riz

  8. #8
    Registered User
    Join Date
    11-29-2016
    Location
    Bengaluru
    MS-Off Ver
    2010
    Posts
    1

    Re: VB Code to delete certain rows and columns

    hi

    i am new to VBA.

    stuck up with one code.

    i have to delete banks heading. if rows contains data also no problem.

    SL.no Name Age

    Like above i have blank heading between 2 column. i want to delete columns only which don't have any value. please help

    Regards
    Asha

+ 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] Delete rows based on the value of two columns using VBA code - Multiple worksheets
    By OmniBlue in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2015, 04:24 PM
  2. [SOLVED] VBA code to search multiple columns and delete any duplicate cells (not rows)
    By philmurp in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-16-2014, 03:27 PM
  3. Replies: 6
    Last Post: 03-04-2013, 12:03 AM
  4. [SOLVED] Transpose Rows to Columns VBA Code and delete specific account numbers
    By cowboys in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-19-2012, 06:10 PM
  5. [SOLVED] Looking for VBA code to delete rows if values in 3 specific columns are the same
    By Priceman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-02-2012, 10:32 AM
  6. Macro to delete certain columns and delete rows based on time in another column
    By beepbeep27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2012, 11:47 AM
  7. Delete & Merge Columns,Delete Rows with filter, etc
    By traderindia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2009, 02:12 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