Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Matching two sheets
Sheet 1 has
District Amount 122 $5,000 122 $10,000 Sheet two has Branch Type 55 VB 85 TB 44 TD 124 AB The branch 55, 124, and 44 belong with district 122. The other numbers need to be deleted, the whole row. I only want the branches that match the district on the 1st sheet . I have code written that picks up the types on sheet two but it is a huge file. I want a code that will look at the district number (which I have 17 others) and match it to the right branch numbers. I have a cell that will always be the correct district number so I can refer to it but I can't get the rest to work. This is the code I have been trying to use but it deletes everything on the sheet. HELP!!!!!!!! For Each Cell In Range("List") 'this range will always have the branch numbers on sheet one Cell.Value = Cell.Value D = Cell.Value With Range("District") 'this is a seperat sheet I made with two columns.The first has the branch numbers and the second column with the district number - the range that is named is ONLY THE Branch number - is this what is wrong?? Set c = .Find(D, LookIn:=xlValues, LookAt:=xlWhole) If Not c Is Nothing Then tt = Range("districtnumber").Value 'this is the district # to use ttt = c.Offset(0, 1).Value If c.Offset(0, 1).Value = Range("DistrictNumber").Value Then Offset(0, 1).Value Else: Selection.EntireRow.Delete End If Else 'do nothing End If End With Next Cell End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Matching data in two sheets | Excel Discussion (Misc queries) | |||
Matching two sheets | Excel Discussion (Misc queries) | |||
Could someone please help me w/ matching the contents of each two sheets? | Excel Discussion (Misc queries) | |||
Help matching entries in two sheets??? | Excel Worksheet Functions | |||
Matching Multiple Sheets | Excel Worksheet Functions |