• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Exact Copy

Titan23

New Member
Hello All--

I am trying to create a macro that will copy a cell (formula range or value range) exactly how it is currently written and then be able to paste it elsewhere, so that when it's pasted it will result in the same result as the original copied formula. Essentially, I want whatever happens when I press "CTRL C" using the native excel shortcut minus the changing of references (I am aware of locking the reference before copying, but I dont want to have to do that every time). Is this possible?
 
Hi,

I send my solution

Instructions

1. Select the range you want to obtain an exact copy
2. Press and hold Ctrl key and then click a cell, which would be the square one for the copy
3. Run the Macro

That's all
Regards

The code

Code:
Option Explicit

Public Sub ExactCopy()


    Dim s As Range
    Set s = Selection
    
    ActiveCell.Resize(s.Rows.Count, s.Columns.Count).Formula = s.Formula

End Sub

Before

83970

After

83971

Normal view

83972
 
Thanks for the response, but I dont think this is working as I envisioned it. I would like to use a shortcut (something like CTRL C for normally copying cells) but when I paste, its an exact copy of the data that was copied, and make no effort to adjust relative references, etc.
 
Hello, as Excel does only an exact copy and has all the necessary within its Paste options​
so just activating the Macro Recorder and well operating manually should give what you expect for …​
 
Hi,

It would be nice if you could upload a sample file with the situation before copying and after pasting, showing the result you want to get instead of writting down and guessing it from my side.

Thank you for helping me to help you
 
Hello, as Excel does only an exact copy and has all the necessary within its Paste options​
so just activating the Macro Recorder and well operating manually should give what you expect for …​
Thanks for the response. I might be missing something, but how does one use the paste options to perform an exact copy to be able to be pasted elsewhere?
 
Hi,

It would be nice if you could upload a sample file with the situation before copying and after pasting, showing the result you want to get instead of writting down and guessing it from my side.

Thank you for helping me to help you
Thank you--I admit that this is a little difficult to describe with words. What I am trying to accomplish can be found in the attached gif. I dont want to necessarily always go down three rows, but rather have the exact formula copy cached to be pasted elsewhere (just like normal with CTRL C). I want to assign this macro with a shortcut (CTRL SHIFT C) so I can use it like CTRL C. Thank you for your help.
 

Attachments

  • Recording 2023-05-03 at 20.57.24.gif
    Recording 2023-05-03 at 20.57.24.gif
    588.7 KB · Views: 6
Hi,

After you have downloaded the attached file, uncompressed it, then open both excels files.

Please follow this instructions:

1. Select G15 cell
2. Press Ctrl and click G19 cell
3. Click ExactCopy button placed at the ribbon
4. You got it

Regards

Before
84021

After

84025
 

Attachments

  • Sample_ExactCopy.rar
    41.7 KB · Views: 3
Last edited:
Back
Top