+ Reply to Thread
Results 1 to 4 of 4

How do I determine the Range that was pasted

  1. #1
    Mike
    Guest

    How do I determine the Range that was pasted

    I want to detect the cells that change on a worksheet as a result of a
    manual copy. For example, I manually select the Range("F16:G26") on some
    other sheet in another Workbook, copy that range, and then click a cell in
    the active sheet and paste it.

    Using the function below I can determine the cell that was clicked and
    changed, but, how do I determine the range of cells that were changed.



    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim aa, cc, rr

    aa = Target

    cc = Target.Column

    rr = Target.row

    End Sub



  2. #2
    Jim Thomlinson
    Guest

    RE: How do I determine the Range that was pasted

    Not really following you. Whe I run this code it gives me tha trange that was
    changed when an etire range of cells are copied in...

    Private Sub Worksheet_Change(ByVal Target As Range)
    MsgBox Target.Address
    End Sub

    I must be missing something...
    --
    HTH...

    Jim Thomlinson


    "Mike" wrote:

    > I want to detect the cells that change on a worksheet as a result of a
    > manual copy. For example, I manually select the Range("F16:G26") on some
    > other sheet in another Workbook, copy that range, and then click a cell in
    > the active sheet and paste it.
    >
    > Using the function below I can determine the cell that was clicked and
    > changed, but, how do I determine the range of cells that were changed.
    >
    >
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > Dim aa, cc, rr
    >
    > aa = Target
    >
    > cc = Target.Column
    >
    > rr = Target.row
    >
    > End Sub
    >
    >
    >


  3. #3
    Gary''s Student
    Guest

    RE: How do I determine the Range that was pasted

    There is a neat trick:

    Say you are copying from Sheet1 to Sheet2 in a total different set of cells.
    After the Paste in Sheet2, the affected cells are Selected, even though you
    selected only one cell as the paste target. So:

    Sub where()
    Sheets("Sheet2").Activate
    s = Selection.Address
    MsgBox (s)
    End Sub

    should reveal the total region pasted in Sheet2.
    --
    Gary''s Student


    "Mike" wrote:

    > I want to detect the cells that change on a worksheet as a result of a
    > manual copy. For example, I manually select the Range("F16:G26") on some
    > other sheet in another Workbook, copy that range, and then click a cell in
    > the active sheet and paste it.
    >
    > Using the function below I can determine the cell that was clicked and
    > changed, but, how do I determine the range of cells that were changed.
    >
    >
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > Dim aa, cc, rr
    >
    > aa = Target
    >
    > cc = Target.Column
    >
    > rr = Target.row
    >
    > End Sub
    >
    >
    >


  4. #4
    Mike
    Guest

    Re: How do I determine the Range that was pasted

    Thanks to both Jim and Gary's Student. Both of your suggestions are what I'm
    looking for.

    thanks,
    mike

    "Mike" <[email protected]> wrote in message
    news:[email protected]...
    >I want to detect the cells that change on a worksheet as a result of a
    >manual copy. For example, I manually select the Range("F16:G26") on some
    >other sheet in another Workbook, copy that range, and then click a cell in
    >the active sheet and paste it.
    >
    > Using the function below I can determine the cell that was clicked and
    > changed, but, how do I determine the range of cells that were changed.
    >
    >
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > Dim aa, cc, rr
    >
    > aa = Target
    >
    > cc = Target.Column
    >
    > rr = Target.row
    >
    > End Sub
    >
    >




+ 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