+ Reply to Thread
Results 1 to 8 of 8

Delete Sheet Rows & Columns based on cell value

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2019 (PC) Version 1808
    Posts
    46

    Delete Sheet Rows & Columns based on cell value

    Hello, I am trying to write a macro to delete all rows below cell with "x" in it, and all columns right of the cell with "y" in it. Any suggestions? See attached, thanks!!
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Delete Sheet Rows & Columns based on cell value

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    04-14-2014
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2019 (PC) Version 1808
    Posts
    46

    Re: Delete Sheet Rows & Columns based on cell value

    Thanks! This is very close, but it only deletes one column to the right of "y" and I need all columns. I will try to adjust the code.

    Any idea how to make this for an Array of Sheets in a workbook?

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Delete Sheet Rows & Columns based on cell value

    The problem of not deleting all the columns may be due to the fact that you may not have column headers in all the columns to the right of the "y". This macro should take care of that:
    Please Login or Register  to view this content.
    Do you want to run the macro on all sheets or just some? If you want to run it only on some sheets, then I would need to know the names of those sheets and/or the names of the sheets you want to exclude.

  5. #5
    Registered User
    Join Date
    04-14-2014
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2019 (PC) Version 1808
    Posts
    46

    Re: Delete Sheet Rows & Columns based on cell value

    Excellent, thanks Mumps! Works great for the sheet. The 3 sheets I would need it for are "EE", "KN", and "SEA" (See revised attachment; "Control" should remain the same).
    Attached Files Attached Files

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Delete Sheet Rows & Columns based on cell value

    Give this a try:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-14-2014
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2019 (PC) Version 1808
    Posts
    46

    Re: Delete Sheet Rows & Columns based on cell value

    Perfect, you rock! Thanks a lot

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Delete Sheet Rows & Columns based on cell value

    You are very welcome.

+ 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. Delete Columns and rows based on cell fill color
    By JackW in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2014, 01:58 PM
  2. Replies: 2
    Last Post: 10-31-2013, 05:00 PM
  3. [SOLVED] Delete rows based on value of two columns
    By ROHAN999 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-07-2013, 11:04 PM
  4. Delete rows based on 3 columns
    By nitin1309 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-27-2013, 03:32 PM
  5. Delete rows based off two columns
    By lricci in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-23-2013, 12:37 PM
  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 Duplicate Rows based on All columns
    By king12yan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-22-2010, 02:36 PM
  8. Delete duplicate rows based on all columns
    By kiran654 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 01-30-2010, 08:14 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