+ Reply to Thread
Results 1 to 2 of 2

Macro to Delete rows and columns

  1. #1
    Registered User
    Join Date
    01-04-2017
    Location
    london, england
    MS-Off Ver
    2016
    Posts
    72

    Unhappy Macro to Delete rows and columns

    Hello

    I have an excel sheet with 7 tabs that already have all formulas intact connected to each other.

    Now this excel sheet has columns and rows for 15 funds. The reason its for 15 is because the maximum limit we use is 15, whereas the minimum is 9, so whenever we use less than 15, we manually have to delete the columns and rows in the excel tabs to remove all the N/A numbers and useless stuff. So my question is, how can I make 1 macro with a drop down menu probably to state if I want 9,10,11,12...15 funds, and after I run it, it will delete the rows and columns from each tab. I won't mind a macro that can count the amount of names I input to determine whether its 9,10,11 etc rather than a drop down menu.

    Note: in the first tab, I have to delete 5 rows per fund (one after the other) and 0 columns, second tab 2 rows per fund that are 10 rows apart (ie. row E and row M), third tab, deleting boxes rather than rows/columns (not so imp, I can manually do this if its too complicated), fourth row: need to delete 2 columns and 2 rows for each fund I take out and the columns and rows are also ie. 8 rows apart and 15 columns apart respectively.

    THANK YOU in advance!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to Delete rows and columns

    Hi,

    For this sort of stuff I generally prefer to use a helper column which identifies whether a row should be deleted. This avoids the need to specify how many rows and which they are. Then I use a macro that filters on the helper column for the rows that need to be deleted and use code like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The helper column cell could be a simple formula that recognises an error cell on the same row.
    e.g.

    =IFERROR(A1,"Delete")
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ 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. VBA macro to delete all empty rows and columns
    By specialist1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2015, 04:01 PM
  2. [SOLVED] Macro to delete set columns and rows
    By tejboyd in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-29-2014, 02:09 PM
  3. Macro to delete rows and columns
    By siroco79 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-04-2013, 07:37 AM
  4. Macro help to search in all columns and delete rows accordingly
    By JonnyNYC90 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-20-2012, 03:44 PM
  5. 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
  6. Macro to delete certain rows and create columns
    By excel77 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2010, 10:06 AM
  7. Using a macro to delete last 4 rows and last 2 columns which vary
    By Shirley Munro in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-01-2005, 12:05 PM

Tags for this Thread

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