LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Copy range if match

Sheet 1. Has two sets of data. B6:G and I6:N.

The code below copies the numbers in column B if they have a match in
column I.

How should I go about changing to copy not only B, but the remaining
row info (B through G) if match. ?


Sub ABC()
Dim cell As Range, c As Range
Dim i As Range, rw As Long
Dim sh As Worksheet
With Worksheets("Data")
Set c = .Range(.Cells(6, "B"), .Cells(6, "B").End(xlDown))
Set i = .Range(.Cells(6, "I"), .Cells(6, "I").End(xlDown))
End With
rw = 2


Set sh = Worksheets("RESULTS")
For Each cell In c
If Application.CountIf(i, cell) 0 Then
sh.Cells(rw, 1) = cell
rw = rw + 1
End If
Next
End Sub


 
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
Match with copy Vic Excel Discussion (Misc queries) 1 November 13th 09 01:49 PM
Match and copy Janette Excel Worksheet Functions 3 July 10th 09 04:50 AM
copy rows that do not match values in dynamic range. Zebrahead Excel Programming 2 March 13th 07 06:27 PM
copy no match [email protected] Excel Programming 2 December 15th 06 01:27 PM
Maybe this isn't possible to match name and copy? Annette[_4_] Excel Programming 18 July 28th 04 02:56 AM


All times are GMT +1. The time now is 06:07 PM.

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

About Us

"It's about Microsoft Excel"