ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem sorting a single column in a shared workbook (https://www.excelbanter.com/excel-programming/334405-problem-sorting-single-column-shared-workbook.html)

hakask

Problem sorting a single column in a shared workbook
 

I´m using the sort method to do a simple sorting in a column. It work
fine by vba sort method (Works fine sorting from menu also afte
selecting a column). The single column (and only that one) is sorte
ok.

BUT: :confused: as soon as I share the workbook (Tools - Shar
workbook... - "Allow..." check box) and do the same thing (sort by m
vba sort method or from menue) ALL columns on that sheet are sorted
not only the selected column.

Is this a bug, or how can I get around this behaviour?

Have got Excel 2000 on a Win2000 machine

--
hakas
-----------------------------------------------------------------------
hakask's Profile: http://www.excelforum.com/member.php...fo&userid=2519
View this thread: http://www.excelforum.com/showthread.php?threadid=38680


Simon Lloyd[_629_]

Problem sorting a single column in a shared workbook
 

Hi post your code and we will all have a better chance of helping you!

Simon


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=386806


hakask[_2_]

Problem sorting a single column in a shared workbook
 

Well, code is not needed as the results are the same if code is used or
sorting from the menue, but here is a quick example code:

Say that you have data ("SORT") in F column and data numeric (1234) in
G column:

Row 4: S : 1
Row 5: O : 2
Row 6: R : 3
Row 7: T : 4

Call a simple sub:
Sub sortColData()
Range("F4:F7").Select
Selection.Sort Key1:=Range("F4"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlSortColumns

End Sub

The result is:

Row 4: O : 1
Row 5: R : 2
Row 6: S : 3
Row 7: T : 4

Fine!

But in a shared workbook the result is:
Row 4: O : 2
Row 5: R : 3
Row 6: S : 1
Row 7: T : 4

Same code (or same menue choice), but different results. :eek:


--
hakask
------------------------------------------------------------------------
hakask's Profile: http://www.excelforum.com/member.php...o&userid=25190
View this thread: http://www.excelforum.com/showthread...hreadid=386806



All times are GMT +1. The time now is 03:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com