Paste Cell Reference into current cell contents

bruderbell

Active Member
Joined
Aug 29, 2006
Messages
374
Hi, I've tried searching the board, but didn't find what I'm looking for.

What I'm trying to do is this:

I want the macro to paste the cell reference (C6, for example) of the currently highlighted cell into an already existing formula in a different cell. Basically, I want it to tag the cell reference onto the end of the current cell text of the 2nd cell. I know how to get the proper cells selected and such, and I know how to do copy-paste stuff. But there doesn't appear to be a special paste that will paste the cell reference. And even more difficult looking is the prospect of tagging this copied info onto the end of the 2nd cell.

Any help?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
not clear.

but try something like this . woes this give you some idea to go about.

Code:
Sub adding()
        Dim a, b As String
        a = Range("c1").Formula
        MsgBox a
        b = Range("C8").Address
        MsgBox b
        Range("a10").Value = a & "*" & b
                End Sub
 
Upvote 0
Thanks for the help. I'm still a little fuzzy on it. Could you tell me what each command does so that I know how to adapt it to my situation?
 
Upvote 0
I suggest
enter some numbers in A1 and B1
enter some formula in C1 e.g. =a1*b1
and enter some number in C8

keep the sheet on one side and the vb editor on the other side in the same screen.
now run the macro by steps i.e. by repeatedly hitting F8
see what happens in the sheet. finally in A10
you will get a hang of the code.
I presume this is what you want.
if it is something else revert to the newsgroup
venkat
 
Upvote 0
Code:
    Dim a, b As String
    a = Range("C4").Formula
    b = Range("A1").Address
    Range("C4").Formula = a & "+" & b

I found that this works. Thanks for the help venkat. Your suggestion got me there.

-bruderbell
 
Upvote 0

Forum statistics

Threads
1,214,873
Messages
6,122,029
Members
449,061
Latest member
TheRealJoaquin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top