Copy a cell to another sheet by double clicking on it

Posted on 2011-04-27
Last Modified: 2012-05-11
How with VBA can you copy a cell to another sheet named "COPY" by double clicking on it . And put it in the first open cell of column a?
Question by:cd_morris
    LVL 30

    Accepted Solution

    Please paste this in the worksheet event.

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
        Dim ws1 As Worksheet
        Dim ws1LastRow As Long
        Set ws1 = Sheets("Copy")
        ws1LastRow = ws1.Range("A" & Rows.Count).End(xlUp).Row + 1
        Target.Copy ws1.Range("A" & ws1LastRow)
    End Sub

    Open in new window

    LVL 30

    Expert Comment

    Here is a sample


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
    This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
    The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
    Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now