none
Excel Range.Replace on single cell doesn't work anymore RRS feed

  • Question

  • Hi,

    i hope this is the correct forum my issue.

    I have an Excel VSTO AddIn written in C#. This was working fine for months and without any changes some functionality is broken.

    I think there is a new bug with inside the latest Excel updates.

    I have a button inside a ribbon, that only replace white-spaces by an empty string. Nothing more.
    Now if I do the replace only on a single cell, all the text on the complete worksheet will be replaced :(

    I created a small repro for this: https://github.com/IT-CASADO/excel-vsto-replace-bug

    Please start the Add-In by pressing F5 in Visual Studio (2019).
    Then open the demo file "DemoData.xlsx"
    Then select the first text block from E7:I16 and click the ribbon button "Click to replace selected cells" -> everything is working only the highlighted range is searched and replaced

    Then select the second text block from E22 (single cell) -> the single cell is highlighted, but unfortunately everything in the active worksheet is searched and replaced

    I tried the same thing with plain VBA (see "DemoData.xls") and everything works as expected!

    For me a bug !?

    Regard,
    Daniel

    Thursday, October 10, 2019 8:41 PM

All replies

  • Can anybody confirm that my given example is not working as expected.

    Thursday, October 24, 2019 12:47 PM
  • I know this is an old thread, but it's basically the same issue that I ran into recently so figured I would chime in. The workaround in the post below (I can't add hyperlinks to a post yet apparently) might be useful for this situation or people who visit this thread in the future.

    https://social.msdn.microsoft.com/Forums/en-US/8bb75c14-a231-4c05-9aba-731145b7c3fb/bug-found-in-rangereplace-c-interop-excel-method?forum=exceldev

    Wednesday, August 5, 2020 5:15 PM