ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is it possible? (https://www.excelbanter.com/excel-programming/350243-possible.html)

STEVEB

Is it possible?
 

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


Bob Phillips[_6_]

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




STEVEB

Is it possible?
 

Hi Bob,

Thanks for your help, I really appreciate it!

I was unable to get the code to work. It was not matching any of the
cells in the range to cell b2 on the other spreadsheet & then copying
the information. Do you have an idea of where I am going wrong?

Thanks again!


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


Bob Phillips[_6_]

Is it possible?
 
Can u post the book somewhere, on the web, not to the NG?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"STEVEB" wrote in
message ...

Hi Bob,

Thanks for your help, I really appreciate it!

I was unable to get the code to work. It was not matching any of the
cells in the range to cell b2 on the other spreadsheet & then copying
the information. Do you have an idea of where I am going wrong?

Thanks again!


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

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




STEVEB

Is it possible?
 

Do you have an e-mail I could send it to?


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


Bob Phillips[_6_]

Is it possible?
 
bob dot phillips at tiscali dot co dot uk

do the obvious

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"STEVEB" wrote in
message ...

Do you have an e-mail I could send it to?


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

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





All times are GMT +1. The time now is 04:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com