!.....VBA Program to Sort Data by Font Color.....!
Sub Sort_by_FontColor()
Application.ScreenUpdating = 0
Columns("b").Insert
For i = 2 To Range("a65536").End(xlUp).Row
Cells(1, 2) = "Color Index"
Cells(i, 2) = Cells(i, 1).Font.ColorIndex
Next
Range("a2:" & Chr(64 + Cells(1, 1).End(xlToRight).Column) & Range("A1").End(xlDown).Row).Sort Range("b2"), xlAscending
Columns("b").Delete
End Sub
Sub Sort_by_FontColor()
Application.ScreenUpdating = 0
Columns("b").Insert
For i = 2 To Range("a65536").End(xlUp).Row
Cells(1, 2) = "Color Index"
Cells(i, 2) = Cells(i, 1).Font.ColorIndex
Next
Range("a2:" & Chr(64 + Cells(1, 1).End(xlToRight).Column) & Range("A1").End(xlDown).Row).Sort Range("b2"), xlAscending
Columns("b").Delete
End Sub
No comments:
Post a Comment