+ Reply to Thread
Results 1 to 6 of 6

Is it possible?

  1. #1
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141

    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

  2. #2
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    >




  3. #3
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141
    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!

  4. #4
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    >




  5. #5
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141
    Do you have an e-mail I could send it to?

  6. #6
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1