Description: Good day to you. Problem is that assigning a sheet to a variable, varible then refers to a sheet that had the initial index. Example: Let's assume there are two sheets in a workbook - SheetOne and SheetTwo. I create variables - sheet_one and sheet_two - and assign them respectively. Then I insert a sheet at a position number 0 — after that var sheet_one refers to a newly created sheet and var sheet_two refers to SheetOne. Works for both Option VBASupport 0 and 1. ```basic Option VBASupport 1 Public Sub Main() With ThisWorkbook.Worksheets Dim sheet_two As Worksheet Set sheet_two = .Item("SheetTwo") .Add Before:=.Worksheets(1) End With Debug.Print sheet_two.Name ' --> "SheetOne" instead of "SheetTwo" End Sub ``` ``` Option VBASupport 0 Public Sub Main() With ThisComponent.Sheets Dim sheet_two As Object sheet_two = .GetByName("SheetTwo") .InsertNewByName("NewShiny", 0) End With Print sheet_two.Name ' --> "SheetOne" instead of "SheetTwo" End Sub ``` Actual Results: "SheetOne" Expected Results: "SheetTwo" Reproducible: Always User Profile Reset: No Additional Info: Macro should correctly assign objects to variables.
*** Bug 167175 has been marked as a duplicate of this bug. ***
Looks like a regression. I suspect my 78a66f99958ed258686cb2fac90f361954b5afe4.
Yes, exactly that 78a66f99958ed258686cb2fac90f361954b5afe4.
https://gerrit.libreoffice.org/c/core/+/186906
Actually, that was after a0403b6eb25a99f6225e0f77f4b14d78f4045c9e.
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/1761796355277ba3a47143729e027a829802b4a3 tdf#167178: make sure to synchronize the tab in AdjustUpdatedRanges It will be available in 26.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Thanks very much!
Still not fixed in 25.2.5.0.0 build from June 25, 2025 04:35
(In reply to lumentulo from comment #8) > Still not fixed in 25.2.5.0.0 build from June 25, 2025 04:35 Which is obvious, given the text in comment 6.
*** Bug 167249 has been marked as a duplicate of this bug. ***
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-25-2": https://git.libreoffice.org/core/commit/5d3a4e6857678f5207aff8669e43c74b91cf3f87 tdf#167178: make sure to synchronize the tab in AdjustUpdatedRanges It will be available in 25.2.5. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-25-8": https://git.libreoffice.org/core/commit/b8df40c4fbef42c2c51258aaed03591b1ff0934c tdf#167178: make sure to synchronize the tab in AdjustUpdatedRanges It will be available in 25.8.0.0.beta2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.