View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Cush Cush is offline
external usenet poster
 
Posts: 126
Default Match data in separate columns!

Option Explicit

Sub FindMatches()
Dim Rng As Range
Dim oCell As Range
Dim lRow As Long


Set Rng = Sheets(1).Range("B2:B10") 'Adjust as needed

For Each oCell In Rng
If oCell < "" And oCell.Value = oCell.Offset(0, 6).Value Then
lRow = Sheets(2).Range("b65536").End(xlUp).Row + 1
oCell.EntireRow.Copy _
Destination:=Sheets(2).Cells(lRow, 1)
End If
Next oCell

End Sub

"Shandy720" wrote:


Hi can someone please give me a little advice on the following,
hopefully if is a simple problem. I have a range of data but am only
interested in rows where the cells in two specific columns are equal.
Therefore I want a macro which will looks through the data and
highlights any rows which have the same value in columns 'B' and 'H',
then copies and pastes this data in another worksheet.

Any help would be very much appreciated,
Thanks kindly,
Andrew


--
Shandy720
------------------------------------------------------------------------
Shandy720's Profile: http://www.excelforum.com/member.php...o&userid=26230
View this thread: http://www.excelforum.com/showthread...hreadid=479065