+ Reply to Thread
Results 1 to 4 of 4

replacing text in a cell without deleting formula

  1. #1
    Registered User
    Join Date
    05-03-2013
    Location
    work
    MS-Off Ver
    Excel 2003
    Posts
    2

    replacing text in a cell without deleting formula

    I have read some of the help and i copied and pasted some VBA that applies to my issue, but it does not work.

    Please Login or Register  to view this content.
    is what i am tryin to use but the formula has quotes in it. I have tried to use the &chr(23) but still not working.

    I have a sheet data is pulled from to fill out cells on another. I have another tab for substitutions for names on the end result tab that references the data tabs, but the VBA does not work so when I type something in the cell it just deletes the formula that is needed if there is no change.
    Last edited by jeffreybrown; 08-02-2020 at 09:02 PM. Reason: Please use code tags!

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: replacing text in a cell without deleting formula

    .
    When using formulas in a macro ... anything that would normally be in quotes if it were written directly into a cell, must be enclosed in double quotes
    in the macro.

    Ex: If you were to enter .... ="22" .... in cell A1

    Then you were to write a macro that included the same formula ... it would need to be written ... =""22""

  3. #3
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: replacing text in a cell without deleting formula

    Quote marks inside of a quoted string should be doubled up (otherwise VB cannot tell if the single quote is the end of a quoted text string or an internal quote mark). So, if your text is this...

    I am a "quoted" text string

    you would assign it to a variable like this...

    Variable = "I am a ""quoted"" text string"

  4. #4
    Registered User
    Join Date
    05-03-2013
    Location
    work
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: replacing text in a cell without deleting formula

    Still just deletes it

+ 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. Replacing specific text in multiple text boxes based on cell values
    By ettevi23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2017, 09:21 PM
  2. [SOLVED] Deleting and replacing characters in a cell
    By fredrbcc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2015, 03:12 PM
  3. Replacing specific text in a cell by row and replace with text in another row
    By merQrey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2014, 10:05 AM
  4. Deleting part of cell contacts, replacing or keeping some
    By twckfa16 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-08-2013, 08:41 PM
  5. Deleting formula and replacing with value
    By jhannes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-09-2012, 06:48 PM
  6. Is there a formula for replacing a symbol with text from another cell?
    By alannanoelle in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-20-2012, 07:12 PM
  7. excel formula - deleting and moving text to a new cell
    By mrpotatohead in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-04-2012, 02:16 PM

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