+ Reply to Thread
Results 1 to 5 of 5

Copy code amendment.

  1. #1
    Forum Contributor
    Join Date
    10-10-2008
    Location
    western hemisphere
    Posts
    126

    Copy code amendment.

    Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
    Dim ws As Worksheet
    Set ws = Sheets("Sheet2")
    irow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
    ws.Cells(irow, 1).Value = Target.Value
    End Sub

    I am using above formula to copy. The problem being faced is that if in any sheet of the workbook is double clicked, the data is copied in sheet 2. Is it possible to amend the formula to make it only a particular sheet(query) specific instead of Workbook.

    thanks

    Flower R
    Last edited by Flower R; 12-11-2008 at 08:47 PM. Reason: typing errors.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Flower, please edit your post and change the quote tags to qode tags.

    If you want the event to fire only for a particular worksheet, put the code in the Worksheet_BeforeDoubleClick event in the appropriate sheet module.
    Last edited by shg; 12-10-2008 at 08:05 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    10-10-2008
    Location
    western hemisphere
    Posts
    126
    I want to fire event from a particular sheet only and be pasted as is being done in sheet two.

    thanks.

    Flower R

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Flower, now that you've removed the quote tags from your code, please add code tags.

    Again, If you want the event to fire only for a particular worksheet, put the code in the Worksheet_BeforeDoubleClick event in the appropriate sheet module. So put this in the Query sheet module:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-10-2008
    Location
    western hemisphere
    Posts
    126
    I tried it several times, but now it is working. So connection is only between 'query' and 'sheet2'. Many thanks.

    Flower R.

+ 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