Thread: Is it possible?
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Is it possible?

Sub CopyData()
Dim rng1 As Range, rng2 As Range

Set rng1 = ActiveSheet.UsedRange
Set rng2 = Worksheets("Sheet2").UsedRange
If ActiveSheet.Evaluate("=SUMPRODUCT(COUNTIF(" & rng1.Address & _
"," & rng2.Address(, , , True) & "))") 0 Then
ActiveSheet.UsedRange.Copy
Worksheets("Sheet2").Select
ActiveSheet.Range("A1").Select
ActiveSheet.Paste
End If

End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"STEVEB" wrote in
message ...

Hi,

I was wondering if it is possible to copy an entire sheet based on
matching cell values? For example of Have a range of cells in column A
sheet 1 spreadsheet 1. If any of the #'s in the range match cell b2 on
spreadsheet 2, I would like to copy that entire sheet to sheet 2
spreadheet 1.

Any help would be greatly appreciated.

Thanks


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile:

http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=500697