+ Reply to Thread
Results 1 to 4 of 4

Need a macro to delete all cells that do not fall under one category

  1. #1
    Registered User
    Join Date
    06-07-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    72

    Need a macro to delete all cells that do not fall under one category

    I have a workbook with 10 sheets. Every sheet has three columns (with the title in cells A1, B1, and C1 respectively): Supervisor, Center, ID Number.

    There are 5 supervisors: Sean, Ye, Marshall, Donald, and Kendrick.

    I need to create a workbook where only one Supervisor's info is present on all 10 sheets and everything else is deleted. Each sheet is of varying length, some sheets may have 200 entries, some may have 2,000.

    This will require 5 different macros (1 for each supervisor), but if you can write me a macro just for Sean I will update it accordingly.

    Thanks!
    Example of what I need (assume the Supervisor cell is in A1):
    EXAMPLE.xlsx
    Last edited by brandonlaw; 07-27-2012 at 02:57 PM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Need a macro to delete all cells that do not fall under one category

    Do you have a sample file that you can attach?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    06-07-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Need a macro to delete all cells that do not fall under one category

    Quote Originally Posted by arlu1201 View Post
    Do you have a sample file that you can attach?
    Yeah, just uploaded it, thanks.

    ---------- Post added at 02:59 PM ---------- Previous post was at 02:58 PM ----------

    If I was to do this without a macro, I'd sort every sheet by supervisor and delete all the rows with supervisors I don't want.

    Hopefully that helps explain what I am looking for.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need a macro to delete all cells that do not fall under one category

    You can do this with an AUTOFILTER. You can use a popup to ask you for the name to filter by.

    Wouldn't it be more practical to leave the 10 sheets as is and collect all of "sean's" info onto one sheet?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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