+ Reply to Thread
Results 1 to 2 of 2

remove entire row from the whole workbook contains a persons name.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    539

    remove entire row from the whole workbook contains a persons name.

    I have been trying various ways to look at the entire workbook and look for a persons name. If the name is found the entire row containing that name should be removed and the rows below it shifted up. (don't want any gaps).
    I don't know what would be better, a cell to populate that the macro looks at to get the name, or a popup window that asks for the name to look for. Either way is good. In the example the macro would look for name 3 and remove its entire row from all the sheets.

    One thing to keep in mind is that the name might or might not be in column A. It might be anywhere in the row.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,640

    Re: remove entire row from the whole workbook contains a persons name.

    Try
    Sub test()
        Dim myName As String, ws As Worksheet, r As Range, rng As Range, ff As String
        myName = InputBox("Enter name")
        If myName = "" Then Exit Sub
        For Each ws In Worksheets
            Set r = ws.Cells.Find(myName, , , 1)
            If Not r Is Nothing Then
                Set rng = r: ff = r.Address
                Do
                    Set rng = Union(rng, r)
                    Set r = ws.Cells.FindNext(r)
                Loop Until ff = r.Address
                rng.EntireRow.Delete
            End If
            Set rng = Nothing
        Next
    End Sub

+ 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] Remove a List of Persons from a Larger List
    By criticalslinky in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 01-10-2024, 02:47 PM
  2. Find and remove entire row
    By BramGrey in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-11-2018, 07:44 AM
  3. [SOLVED] formula to auto populate entire workbook for a entire year
    By COURTTROOPER in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-15-2017, 02:06 PM
  4. [SOLVED] Remove lines based on cell value (remove lines in range, not entire row)
    By Tapyr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-27-2015, 07:31 AM
  5. Macro to remove highlights from entire workbook?
    By nobodyukno in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2015, 03:39 PM
  6. Replies: 0
    Last Post: 02-14-2012, 12:34 PM
  7. Remove all instances of a color in entire workbook
    By skyping in forum Excel General
    Replies: 4
    Last Post: 11-15-2010, 12:33 PM

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