![]() |
Need help with Excel Macro for searching
Hello,
I have been trying various methods for the past 2 days to do what I need, but still no luck. Let me outline what it is I am trying to do. 1. I have a Excel workbook with 2 worksheets (AllUsers & Master) The AllUsers sheet has the data that I want to modify/cleanup and the Master is just a list of User ID's (A:A). The data in AllUsers includes the User ID in column D. What I am trying to do is create a macro that will search for all the users in A:A of the Master sheet and delete the rows where those ID's showup in AllUsers. Any help is appreciated!! Thanks! |
Need help with Excel Macro for searching
Sub DeleteUsers()
MasterRowCount = 1 With Sheets("Master") Do While .Range("A" & MasterRowCount) < "" UserID = .Range("A" & MasterRowCount) With Sheets("AllUsers") Set c = .Columns("D:D").Find(what:=UserID, _ LookIn:=xlValues) If Not c Is Nothing Then .Rows(c.Row).Delete End If End With MasterRowCount = MasterRowCount + 1 Loop End With End Sub " wrote: Hello, I have been trying various methods for the past 2 days to do what I need, but still no luck. Let me outline what it is I am trying to do. 1. I have a Excel workbook with 2 worksheets (AllUsers & Master) The AllUsers sheet has the data that I want to modify/cleanup and the Master is just a list of User ID's (A:A). The data in AllUsers includes the User ID in column D. What I am trying to do is create a macro that will search for all the users in A:A of the Master sheet and delete the rows where those ID's showup in AllUsers. Any help is appreciated!! Thanks! |
Need help with Excel Macro for searching
Use a formula in column B or Master
=ISNUMBER(MATCH(A2,AllUsers!D:D,FALSE)) and copy down to match your list, then sort or filter on column B, and delete the rows where the formula returns TRUE. HTH, Bernie MS Excel MVP wrote in message ups.com... Hello, I have been trying various methods for the past 2 days to do what I need, but still no luck. Let me outline what it is I am trying to do. 1. I have a Excel workbook with 2 worksheets (AllUsers & Master) The AllUsers sheet has the data that I want to modify/cleanup and the Master is just a list of User ID's (A:A). The data in AllUsers includes the User ID in column D. What I am trying to do is create a macro that will search for all the users in A:A of the Master sheet and delete the rows where those ID's showup in AllUsers. Any help is appreciated!! Thanks! |
All times are GMT +1. The time now is 06:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com