Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default 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
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
Matching data in two sheets CP Excel Discussion (Misc queries) 3 March 2nd 09 02:13 PM
Matching two sheets Riyad Excel Discussion (Misc queries) 1 May 18th 06 05:02 PM
Could someone please help me w/ matching the contents of each two sheets? bxc2739 Excel Discussion (Misc queries) 4 April 26th 06 11:04 PM
Help matching entries in two sheets??? Curalice Excel Worksheet Functions 2 November 12th 05 07:53 PM
Matching Multiple Sheets phil Excel Worksheet Functions 0 September 23rd 05 03:30 PM


All times are GMT +1. The time now is 09:14 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"