How do I sort two columns without changing the formatting?

P

Peo Sjoblom

Copy the columns somewhere else, sort them, select the old columns and do
edit>paste special and select values
 
L

LisaD

I guess I can do that. It just seems like a lot of extra work. Are there any
other ideas. Doesn't the program have some sort of fuction to allow formats
to stay the same?
 
B

Bill Kuunders

3 options..

enter the names on a clean unshaded sheet
do the sort
copy the names and
go to a sheet with the shaded lines
and edit... paste special... values

or
have a list of pupils on a shaded lines sheet in alphabetical order
just mark cells next to the names

or
use a macro to do the sort and re- shade the lines after the sort

Sub ShadeEveryOtherRow()
Dim Counter As Integer

Sheets("sheet4").Select
Range("A1:M40").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Range("A1").Select

For Counter = 1 To 40
'If the row is an odd number (within the selection)...
If Counter Mod 2 = 1 Then
'Set the pattern to xlGray16.
Rows(Counter).Interior.Pattern = xlGray16

Else
Rows(Counter).Interior.Pattern = nil
End If
Next

End Sub

You will have to adjust the ranges to suit.
 
S

Susan

if it's banded shading, you can input that with conditional formatting
& then when you sort it, the banding will stay put..........

conditional formatting:
formula =
=mod(row(),2)=0
set format

susan
 
Top