Consulting

Results 1 to 9 of 9

Thread: Formula being replaced with result

  1. #1
    VBAX Regular
    Joined
    Sep 2011
    Posts
    78
    Location

    Formula being replaced with result

    Hi All,

    The formulas in certain column, e.g. in c1 "=b1-a1", is replaced with the result.

    I assume it is caused by a setting somewhere that I am unaware of.

    Your assistance would be much appreciated.

    Zagrijs

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    The only setting I know that affects that area is under Options

    Are you sure that you or a macro did not do a PasteValues to those cells?
    Attached Images Attached Images
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Regular
    Joined
    Sep 2011
    Posts
    78
    Location
    Quote Originally Posted by Paul_Hossler View Post
    The only setting I know that affects that area is under Options

    Are you sure that you or a macro did not do a PasteValues to those cells?


    Thanks for your reply, Paul

    The data has been "imported" with a macro from other workbooks, yes.

    Seems that I would have to rewrite the macro.

    Zagrijs

  4. #4
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Just in case: this will also happen if you use a formula in a table header, or if you have a userform control whose controlsource is linked to the cell.
    Be as you wish to seem

  5. #5
    VBAX Regular
    Joined
    Sep 2011
    Posts
    78
    Location
    Quote Originally Posted by Aflatoon View Post
    Just in case: this will also happen if you use a formula in a table header, or if you have a userform control whose controlsource is linked to the cell.

    Thanks Aflatoon.

    It is not linked to a table header or use form control, not that I am aware of.

    I have a destination workbook into which the information from source workbooks have to be imported.

    In the sub I used >> worksheet.range(a,z).value = worksheet.range(a,z).value <<

    The specific column had the formula to calculate the difference between two dates in the source workbook. Obviously only the value, and not the formula, was copied to the destination workbook. When I try to change the value ion the destination workbook to a formula again, it immediately reverts back to the value.

    I tried to create the formula in another cell that is unaffected and copied it to a cell in the affected column. So far so good! But when I try to copy that cell's contents, the formula, to the other cells in the column, the source cell immediately reverts back to the value.

    I have never come across this and it leaves me baffled.

    It would seem that something was changed in the destination workbook when the values were transferred from the source workbooks and I don't have an idea what changed and how to correct is

    Regards

  6. #6
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    It sounds as though there is a Worksheet_Change event (probably in the destination workbook) which is converting the formula back to a value. Right-click the worksheet tab, choose 'View Code' and then see if there is any code shown.
    Be as you wish to seem

  7. #7
    VBAX Regular
    Joined
    Sep 2011
    Posts
    78
    Location

    SOLVED

    Quote Originally Posted by Aflatoon View Post
    It sounds as though there is a Worksheet_Change event (probably in the destination workbook) which is converting the formula back to a value. Right-click the worksheet tab, choose 'View Code' and then see if there is any code shown.
    Thanks!

    Not Worksheet_Change event, Worksheet_SelectionChange event.

    Zagrijs.

    PS. I have not been on the forum for a while and I don't see the "tab" where I can mark it "SOLVED"; I have put "SOLVED" in the title.

  8. #8
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Top right under [Thread Tools] -- you (as the originator) get an extra button on your post to mark it solved
    Attached Images Attached Images
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  9. #9
    VBAX Regular
    Joined
    Sep 2011
    Posts
    78
    Location
    Thanks! Done!

Tags for this Thread

Posting Permissions

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