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?
 

Some videos you may like

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

venkat1926

Well-known Member
Joined
Aug 21, 2005
Messages
4,824
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
 

bruderbell

Active Member
Joined
Aug 29, 2006
Messages
374
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?
 

venkat1926

Well-known Member
Joined
Aug 21, 2005
Messages
4,824
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
 

bruderbell

Active Member
Joined
Aug 29, 2006
Messages
374
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
 

Watch MrExcel Video

Forum statistics

Threads
1,114,060
Messages
5,545,761
Members
410,704
Latest member
Cobber2008
Top