Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Apr 18, 8:55*am, suyog_linux wrote:
Hi All, I am looking for hel to delete data from one of the huge excel file I have. Actually, I have two excel files, one contains data regarding Users with UserName as primary key and other excel file contains some of user ID's which also exist in first file. I would like to get help with a VBA code which will take inputs from one of the excel file search for that UserName in the file and delete the whole row if UserName is matched. Appreciating the help in this regard. Thanks, Suyog Shah Hi Suyog, Try the following code. Sub DelUsers() ' User data is on data sheet. IDs to delete ' is a list of IDs on sheet "IDsToDel" Dim rUID As Range Dim rData As Range Dim c As Range, x As Range Set rData = Sheets("Data").Range("A1").CurrentRegion.Columns(1 ) Set rData = rData.Offset(1, 0).Resize(rData.Rows.Count - 1, 1) 'Debug.Print rData.Address Set rUID = Sheets("IDsToDel").Range("A1").CurrentRegion For Each c In rUID.Cells For Each x In rData.Cells If LCase(c.Value) = LCase(x.Value) Then x.EntireRow.Delete Exit For End If Next x Next c End Sub Anant |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting Rows based on multiple criteria | Excel Programming | |||
Deleting blanks rows based on multiple criteria | Excel Programming | |||
Deleting entire rows based on certain criteria | Excel Programming | |||
Deleting rows based on multiple criteria | Excel Programming | |||
Deleting rows based on criteria | Excel Programming |