Results 1 to 8 of 8
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Posts
    1,418
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Adding A Formula From One Cell To Another Cell (2003)

    Scenario: I have a formula in cell A1 that includes 2 links to 2 cells on 2 other worksheets in the same workbook. I would like to add a a linkthat is in cell B1 to the formula in cell A1. Any ideas?
    Thanks in advance.

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Adding A Formula From One Cell To Another Cell (2003)

    Not sure I completely understand. What kind of "links" are you talking about? A cell can only have 1 hyperlink. Are you talking about dependent cells or what?

    To have in B1 a display of the formula from A1 you can add the UDF into a module:
    <pre>Function Getformula(rng As Range)
    Getformula = rng.Cells(1).Formula
    End Function</pre>


    Then in B1 enter:
    <pre>=GetFormula(a1)</pre>


    Steve

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Posts
    1,418
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Adding A Formula From One Cell To Another Cell (2003)

    Thanks, Steve. Let me try to explain it a little more clearly: In cell A1 on Sheet 1 of Workbook "Book 2" I have the formula "=Sheet2!B1+Sheet3!C1". In cell B1 I have the formula "=Sheet4!B1". I would like to add the formula in cell B1 to the formula in cell A1. Hopefully this is a little more clear.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adding A Formula From One Cell To Another Cell (2003)

    What would you want the result to be?

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Posts
    1,418
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Adding A Formula From One Cell To Another Cell (2003)

    The formula "=Sheet2!B1+Sheet3!C1+Sheet4!B1" in cell A1.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adding A Formula From One Cell To Another Cell (2003)

    Why would you want to do that? You can easily add the results of the formulas.

  7. #7
    Bronze Lounger
    Join Date
    Jan 2001
    Posts
    1,418
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Adding A Formula From One Cell To Another Cell (2003)

    Thanks, Hans. Yes, I know. However, I wanted a simple method of adding what might very well be very long and complicated formulas/links into one cell directly.
    Any ideas?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adding A Formula From One Cell To Another Cell (2003)

    For what it's worth, you can use code like this:

    Range("A1").Formula = Range("A1").Formula & "+" & Mid(Range("B1").Formula, 2)

    <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •