+ Reply to Thread
Results 1 to 3 of 3

replacing cell references with value within a formula

  1. #1
    Registered User
    Join Date
    12-20-2014
    Location
    West Coast USA (PST/PDT)
    MS-Off Ver
    2016 / o365
    Posts
    36

    replacing cell references with value within a formula

    Hi:
    Several years ago (between 2013 and 2018??) I found and tweaked code which would do the deceptively simple task of replacing cell references with their values in a selection. For example, if A1=10, and A5=15, and formula in C3 was =A1+A5, then it would change C3 to =10+15, i.e. retain the basic math. It worked over a selection, whether row or column. I don't recall if it worked with absolute references (e.g. $A1 or A$1), but that's not an issue here. Hopefully I have terminology right.

    Unfortunately I seem to have lost this code, and after spending an hour searching google and the two major excel forums, I've been unable to find this. I'll keep searching.

    Meantime, would someone happen to have the post bookmarked or saved?
    Thank you for any leads here!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: replacing cell references with value within a formula

    Maybe something like

    Range("C1") = "=" & Range("A1").Value & "+" & Range("B1").Value


    Incidentally would you set your location to something meaningful please. It can often help if we need to consider stuff like Regional settings or date formats
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    12-20-2014
    Location
    West Coast USA (PST/PDT)
    MS-Off Ver
    2016 / o365
    Posts
    36

    Re: replacing cell references with value within a formula

    Thank you. I just found code from another site which works only on the active cell, and has author credit in it from 2005. Not sure I'm allowed to post it. Parts of the code don't make sense to me what it is doing. It accomplishes the task but have to do it cell by cell. I suppose I could call that function and pass it a specific cell by looping through the selection.

    Going to keep searching. Wish I could find it from a few years ago, it was so elegant and clean. Funny how the results today in both google and the forums are so different from 5+ years ago.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Maintain Formula References when replacing tabs
    By maddogp in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-19-2015, 03:17 PM
  2. [SOLVED] Replacing mathematical operators with cell references
    By dactylonomy in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-03-2015, 05:27 PM
  3. Replacing cell value without replacing formula in the cell
    By kingoftheace in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-17-2012, 06:28 AM
  4. Replies: 3
    Last Post: 12-30-2010, 05:23 PM
  5. Replacing references in two columns
    By greek in forum Excel General
    Replies: 9
    Last Post: 10-31-2009, 04:46 AM
  6. Replies: 3
    Last Post: 02-08-2006, 09:10 AM
  7. [SOLVED] Replacing references from one file to another
    By ewan7279 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2005, 07:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1