ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   When I sort it is carrying my formatting of cells (https://www.excelbanter.com/excel-programming/382192-when-i-sort-carrying-my-formatting-cells.html)

Dave Marden[_6_]

When I sort it is carrying my formatting of cells
 
When I sort it carries my formatting of my cells with me, the same
program didn't used to when I was only sorting half the amount of data. I
want the values to be sorted while maintaining the formatting as it starts
out.

Public Sub SortCompetitors_Click()
If intSortMethod = 1 Then
strKey1Range = "X4"
strKey2Range = "W4"
strOrder1 = xlAscending
End If
If intSortMethod = 2 Then
strKey1Range = "W4"
strKey2Range = "V4"
strOrder1 = xlDescending
End If
If Range("Sheet3Protection") = "False" Then
ReadInfoFromForm
WriteInfoToSpreadsheet
Range("D4:BK51").Select
Selection.Sort Key1:=Range(strKey1Range), Key2:=Range(strKey2Range),
Order1:=strOrder1, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Range("D4").Select
ReadFromSpreadsheet
WriteInfoToForm
Else
UnprotectCompetitorsSheet
ReadInfoFromForm
WriteInfoToSpreadsheet
Range("D4:BK51").Select
Selection.Sort Key1:=Range(strKey1Range), Key2:=Range(strKey2Range),
Order1:=strOrder1, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Range("D4").Select
ReadFromSpreadsheet
WriteInfoToForm
ProtectCompetitorsSheet
End If
End Sub

Thanks,
Dave Marden



Jim Cone

When I sort it is carrying my formatting of cells
 
Dave,
Sorting carries the cell format with the data - except for borders and
conditional formatting.
If the cells are conditionally formatted then sorting the data changes
the cell contents which can trigger the CF.
Also, the "WriteInfoToSpreadsheet" routine could be changing the
cell formatting prior to the sort.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Dave Marden"
wrote in message
When I sort it carries my formatting of my cells with me, the same
program didn't used to when I was only sorting half the amount of data. I
want the values to be sorted while maintaining the formatting as it starts
out.

Public Sub SortCompetitors_Click()
If intSortMethod = 1 Then
strKey1Range = "X4"
strKey2Range = "W4"
strOrder1 = xlAscending
End If
If intSortMethod = 2 Then
strKey1Range = "W4"
strKey2Range = "V4"
strOrder1 = xlDescending
End If
If Range("Sheet3Protection") = "False" Then
ReadInfoFromForm
WriteInfoToSpreadsheet
Range("D4:BK51").Select
Selection.Sort Key1:=Range(strKey1Range), Key2:=Range(strKey2Range),
Order1:=strOrder1, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Range("D4").Select
ReadFromSpreadsheet
WriteInfoToForm
Else
UnprotectCompetitorsSheet
ReadInfoFromForm
WriteInfoToSpreadsheet
Range("D4:BK51").Select
Selection.Sort Key1:=Range(strKey1Range), Key2:=Range(strKey2Range),
Order1:=strOrder1, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Range("D4").Select
ReadFromSpreadsheet
WriteInfoToForm
ProtectCompetitorsSheet
End If
End Sub

Thanks,
Dave Marden



Dave Marden[_6_]

When I sort it is carrying my formatting of cells
 
Isn't there any way of turning this off? I have a scoreboard that I created
and I want every other line to have the same formatting. It would seem to
me that it would be an option you could turn on and off.

Thanks Again,
Dave Marden



"Jim Cone" wrote in message
...
Dave,
Sorting carries the cell format with the data - except for borders and
conditional formatting.
If the cells are conditionally formatted then sorting the data changes
the cell contents which can trigger the CF.
Also, the "WriteInfoToSpreadsheet" routine could be changing the
cell formatting prior to the sort.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Dave Marden"
wrote in message
When I sort it carries my formatting of my cells with me, the same
program didn't used to when I was only sorting half the amount of data. I
want the values to be sorted while maintaining the formatting as it starts
out.

Public Sub SortCompetitors_Click()
If intSortMethod = 1 Then
strKey1Range = "X4"
strKey2Range = "W4"
strOrder1 = xlAscending
End If
If intSortMethod = 2 Then
strKey1Range = "W4"
strKey2Range = "V4"
strOrder1 = xlDescending
End If
If Range("Sheet3Protection") = "False" Then
ReadInfoFromForm
WriteInfoToSpreadsheet
Range("D4:BK51").Select
Selection.Sort Key1:=Range(strKey1Range),
Key2:=Range(strKey2Range),
Order1:=strOrder1, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Range("D4").Select
ReadFromSpreadsheet
WriteInfoToForm
Else
UnprotectCompetitorsSheet
ReadInfoFromForm
WriteInfoToSpreadsheet
Range("D4:BK51").Select
Selection.Sort Key1:=Range(strKey1Range),
Key2:=Range(strKey2Range),
Order1:=strOrder1, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Range("D4").Select
ReadFromSpreadsheet
WriteInfoToForm
ProtectCompetitorsSheet
End If
End Sub

Thanks,
Dave Marden





Jim Cone

When I sort it is carrying my formatting of cells
 
That's the way it is...
However, you could eliminate your current cell formatting and use
conditional formatting on the score board. In the CF dialog box, choose
"Formula is" and enter =MOD(ROW(),2)=0 to shade alternate
rows (in the selection). The CF is not affected by sorting.
-or-
Try out the free Excel add-in "Shade Date Rows" which can shade
by cell value or by every nth row or every nth row group.
Download from... http://www.realezsites.com/bus/primitivesoftware
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html



"Dave Marden"
wrote in message
Isn't there any way of turning this off? I have a scoreboard that I created
and I want every other line to have the same formatting. It would seem to
me that it would be an option you could turn on and off.

Thanks Again,
Dave Marden



"Jim Cone" wrote in message
...
Dave,
Sorting carries the cell format with the data - except for borders and
conditional formatting.
If the cells are conditionally formatted then sorting the data changes
the cell contents which can trigger the CF.
Also, the "WriteInfoToSpreadsheet" routine could be changing the
cell formatting prior to the sort.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



Dave Marden[_6_]

When I sort it is carrying my formatting of cells
 
Cool, Thanks for the help.

Dave Marden


"Jim Cone" wrote in message
...
That's the way it is...
However, you could eliminate your current cell formatting and use
conditional formatting on the score board. In the CF dialog box, choose
"Formula is" and enter =MOD(ROW(),2)=0 to shade alternate
rows (in the selection). The CF is not affected by sorting.
-or-
Try out the free Excel add-in "Shade Date Rows" which can shade
by cell value or by every nth row or every nth row group.
Download from... http://www.realezsites.com/bus/primitivesoftware
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html



"Dave Marden"
wrote in message
Isn't there any way of turning this off? I have a scoreboard that I
created
and I want every other line to have the same formatting. It would seem to
me that it would be an option you could turn on and off.

Thanks Again,
Dave Marden



"Jim Cone" wrote in message
...
Dave,
Sorting carries the cell format with the data - except for borders and
conditional formatting.
If the cells are conditionally formatted then sorting the data changes
the cell contents which can trigger the CF.
Also, the "WriteInfoToSpreadsheet" routine could be changing the
cell formatting prior to the sort.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware






All times are GMT +1. The time now is 10:04 AM.

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