PDA

View Full Version : peraphs impossible... order line base color...



sal21
02-07-2008, 09:59 AM
Is possible to order line in sheet based 2 key, color in column AF and value in column AE????
i use in standard mode:

Sub ORDINA_REGIONI()

Dim WS As Worksheet
Dim ULTIMA As Long
Dim MIO_RANGE As RANGE

Set WS = Worksheets("STAT_NEW_1")

With WS

.Unprotect PASSWORD:="SAL21"

ULTIMA = Sheets("STAT_NEW_1").RANGE("AF" & Rows.Count).End(xlUp).Row
Set MIO_RANGE = Sheets("STAT_NEW_1").RANGE("A5:AF" & ULTIMA)
MIO_RANGE.Sort Key1:=RANGE("AF5"), Order1:=xlAscending, Key2:=RANGE("A5") _
, Order2:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

.Protect PASSWORD:="SAL21"

End With

End Sub

Trevor
02-08-2008, 07:39 PM
I'm not sure I understand your question. Do you just want to change a cell or row color? if so Right click fomat cell , if it a row highlight the row and right click format cell.

mikerickson
02-09-2008, 01:25 PM
You could try this, in a new workbook, put =ROW() in A1:A150 and =0 in A151. Then use Excel Options CustomList to import the custom list

1,2,3,...,150,0

When you Sort, sort on AE using that list as the sort order.

Condiditonal formatting will keep the colors of AF correct.