Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default 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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for searching out side excel?? Maria.N[_3_] Excel Programming 1 July 25th 06 02:18 PM
Saving and searching Macro TomBP Excel Programming 3 July 6th 06 03:49 PM
Searching Macro Dallas Green Excel Discussion (Misc queries) 3 May 13th 05 02:36 PM
Searching Data using Macro anang Excel Programming 1 October 12th 04 12:36 PM
searching different files macro fullymooned[_4_] Excel Programming 1 May 19th 04 05:36 PM


All times are GMT +1. The time now is 05:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"