Copying Data without Leaving the Currently Selected Cell

Written by Allen Wyatt (last updated December 18, 2021)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


Henri would like to copy the data contained in a source cell to a destination cell without leaving the current position on the worksheet. In other words, he would like to copy from cell A1 to cell AE459 without leaving his current position at V104. He wonders if such an edit is even possible.

Of course, the obvious approach to this is to simply put the formula =A1 into cell AE459. Then, Excel takes care of making sure that the two cells are equal. You could also open a second window on the worksheet and take care of the copying within that window; the cell selected in the original window (cell V104) would remain unchanged.

If you actually want to do a "copy" operation, though, without opening a second window, then you'll need to resort to a macro.

Copying from one cell to another within a macro is rather easy. For instance, the following example will copy the contents of cell A1 to AE459 without affecting whatever cell you currently have selected:

Sub CopyCell1()
'   Copy the cell value to destination cell
    Range("AE459") = Range("A1")
End Sub

If you want to copy a formula that is in cell A1 to the destination, then you need to modify how the copy is done. Specifically, you need to use the Copy method using the destination range as a parameter.

Sub CopyCell2()
'   Copy the relative formula to destination
    Range("A1").Copy Range("AE459")
End Sub

Of course, a drawback of these macros is that they are static—they only copy from cell A1 to cell AE459. If your copying needs can vary, you may want to consider performing the task in the VB Editor's Immediate window. Just pop open the editor and type the single line from the appropriate macro into the window. The copying is then done and you can close the editor, all without affecting whatever cell you had selected.

Another way to provide a bit of flexibility into the source and destination for the macro is to have it (the macro) prompt the user for the source and destination. The following macro takes this approach.

Sub CopyCell3()
    Dim SrceCell As String
    Dim DestCell As String

    SrceCell = InputBox("Copy From Cell ...")
    DestCell = InputBox("Copy To Cell ...")
    Range(DestCell) = Range(SrceCell)
End Sub

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9949) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Quickly Displaying the Style Dialog Box

If you display the style area, you can quickly display the Style dialog box.

Discover More

Selective Undo

Ever wonder why you can't undo just a single edit you made a few minutes earlier? The short answer is that it could make ...

Discover More

Removing All Bookmarks

Need to get rid of a lot of bookmarks all at once? Word doesn't provide a way to do it, but you can use the short macro ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Stopping Feet and Inches from Converting to Dates

When pasting information into a worksheet, Excel tries to helpfully convert that information. This can cause undesired ...

Discover More

Mouse Scroll Wheel Doesn't Work when Editing Formulas

Using your mouse to select cells for inclusion in a formula can be an exercise in futility on some systems. Here's why ...

Discover More

Splitting Information into Rows

Got too much information in a single cell? Here's how you can use a macro to pull apart that information and put it into ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five more than 8?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.