Bug 149579 - VBA Range.Sort should expand a single cell range to Range.CurrentRegion
Summary: VBA Range.Sort should expand a single cell range to Range.CurrentRegion
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Eike Rathke
URL:
Whiteboard: target:7.5.0 target:7.4.0.0.beta2
Keywords:
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2022-06-15 18:53 UTC by Eike Rathke
Modified: 2022-06-19 23:58 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
TestcaseVBASort.xls (30.50 KB, application/vnd.ms-excel)
2022-06-19 23:43 UTC, Óvári
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eike Rathke 2022-06-15 18:53:00 UTC
If

  Worksheets(1).Range("A1").Sort

is given, the single cell range A1 should be expanded to the Range.CurrentRegion contiguous data area, same as if Sort was invoked by UI and Excel does in VBA.

RFE created from
https://ask.libreoffice.org/t/microsoft-excel-vba-sort-function-which-works-with-libreoffice-calc-without-modification/78606

See also
https://docs.microsoft.com/en-us/office/vba/api/excel.range.sort
https://docs.microsoft.com/en-us/office/vba/api/excel.range.currentregion
Comment 1 Commit Notification 2022-06-16 14:26:50 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/14ce950083cab9ca8067f36dc08ca5bfb33ae046

Resolves: tdf#149579 Expand Range.Sort single cell to Range.CurrentRegion

It will be available in 7.5.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.
Comment 2 Commit Notification 2022-06-16 15:47:31 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/7c34db88f3ee99dbb495f3643ab956d7467d5e00

Resolves: tdf#149579 Expand Range.Sort single cell to Range.CurrentRegion

It will be available in 7.4.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.
Comment 3 Commit Notification 2022-06-17 11:25:32 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/bf195037e2e59c46a8b7d149aedb79357e5ea978

tdf#149579: sc_vba_macro_test: Add unittest

It will be available in 7.5.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.
Comment 4 Óvári 2022-06-19 23:43:22 UTC
Created attachment 180838 [details]
TestcaseVBASort.xls

Attached file is a testcase that produces the same results with MS Excel 2010 and LO Calc 7.5.0.0.alpha0+ ca47989ad60b1414f92be22a1fbf4c1d1a92dd97. Verified fixed. Thank you
Comment 5 Óvári 2022-06-19 23:50:59 UTC
1. Should this enhancement be added to the "LibreOffice 7.4 Community: Release Notes" at:
https://wiki.documentfoundation.org/ReleaseNotes/7.4#VBA_Support
?

2. Does this enhancement need to go into the LO Help file?

3. Should LO BASIC also automagically* expand the region if only 1 cell is selected? If so, should new issue be created?

Thank you

*automagically https://ask.libreoffice.org/t/microsoft-excel-vba-sort-function-which-works-with-libreoffice-calc-without-modification/78606/5
Comment 6 Óvári 2022-06-19 23:58:08 UTC
(In reply to Óvári from comment #5)
> 1. Should this enhancement be added to the "LibreOffice 7.4 Community:
> Release Notes" at:
> https://wiki.documentfoundation.org/ReleaseNotes/7.4#VBA_Support
> ?
Done. Feel free to update as required. Thank you