+ Reply to Thread
Results 1 to 7 of 7

Replace Part of formula Not Work, Why?

  1. #1
    Forum Contributor
    Join Date
    07-20-2012
    Location
    Kingdom of Saudi Arabia
    MS-Off Ver
    Excel 2016
    Posts
    103

    Replace Part of formula Not Work, Why?

    Hi everyone,

    I have a cell in Sheet3 contains the following formula

    Please Login or Register  to view this content.
    after i selected the cell, I used the following macro to replace part of the formula:

    Please Login or Register  to view this content.

    The expected result after replacement occurs it should be like following:

    Please Login or Register  to view this content.
    But the replacement not occurs. WHY?
    Last edited by exceere; 04-19-2020 at 10:09 AM.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Replace Part of formula Not Work, Why?

    I don't know why you're doing it but there is a mixi of separators in your code

    Please Login or Register  to view this content.
    You're using ; and , , something's surely wrong there and probably that's what avoids the modifications.
    You MUST get an error
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

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

    Re: Replace Part of formula Not Work, Why?

    Quote Originally Posted by exceere View Post
    Please Login or Register  to view this content.
    Your main problem is that all quote marks inside of the quote marks that delineate a text constant must be doubled up. So each "" that I highlighted in red needs to be """" instead. In addition, I notice you switched the comma delineators for your formulas to semi-colons in the Replace function call... if your delineators are commas, then you need to use commas there to.

  4. #4
    Forum Contributor
    Join Date
    07-20-2012
    Location
    Kingdom of Saudi Arabia
    MS-Off Ver
    Excel 2016
    Posts
    103

    Re: Replace Part of formula Not Work, Why?

    Thank you Keebellah,
    Thank you Rick Rothstein,

    Your are correct. I edit the post. (The separators in the functions is ";").

    Rick Rothstein, i made a modification on the line as following:

    Please Login or Register  to view this content.
    And it solves the problem.

    Thank you very much.
    Last edited by exceere; 04-19-2020 at 10:34 AM.

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Replace Part of formula Not Work, Why?

    Why do you replace the contents, if you are using macros anyway then I suggest you just rebuild the formula with a macro
    Simplest way. start the macro recorder and select the formula, make the change from row 30 to 32 and sop the recorder, then look at the vba code, maybe it'll inspire you.

  6. #6
    Forum Contributor
    Join Date
    07-20-2012
    Location
    Kingdom of Saudi Arabia
    MS-Off Ver
    Excel 2016
    Posts
    103

    Re: Replace Part of formula Not Work, Why?

    Keebellah,

    Thank you for your suggestion.

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Replace Part of formula Not Work, Why?

    You're welcome, but did it solve your problem?

+ 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. [SOLVED] how to replace a part of the formula in all the columns?
    By sumesh56 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-17-2017, 12:13 PM
  2. [SOLVED] VBA replace part of formula IF and VLOOKUP
    By Made in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-12-2016, 08:53 AM
  3. Need to find and replace with work sheet name part of a formula
    By aripori in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-29-2015, 07:45 AM
  4. How to replace part of a formula with VBA
    By rockfrawg in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-17-2014, 05:23 PM
  5. Replace part of formula VBA
    By Testnntest in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-28-2013, 04:20 AM
  6. How do I replace part of a formula using VBA?
    By Vaslo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2012, 12:46 PM
  7. [SOLVED] Q: DDE Link - Replace Part of the Formula
    By Reto Walker in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-14-2006, 12:15 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