Showing posts with label Sort Data on the basis of Font Color. Show all posts
Showing posts with label Sort Data on the basis of Font Color. Show all posts

Friday, October 21, 2011

Sort Data on the basis of Font Color

If you want to sort or arrange the data on the basis of font color. Snapshot Below-



Sub sort_on_font_color()
Dim i As Long
' we will ADD Temp data to Col B and find the color index of all cells of columm a and , after that
' we will sort the data on the basis of color index and then we will delte all the temp data of col B
Sheets(1).Range("b1").Value = "Color Index"

' first we will get the color index for all the font colors of cells of cOL A IN Col B
For i = 2 To Sheets(1).Range("a1").End(xlDown).Row
Sheets(1).Cells(i, 2).Value = Sheets(1).Cells(i, 1).Font.ColorIndex
Next i
Sheets(1).Range("a1:b" & Range("a1").End(xlDown).Row).Sort key1:=Sheets(1).Range("b:b"), order1:=xlAscending, Header:=xlYes
Sheets(1).Columns("b:b").Delete
Sheets(1).Cells(1, 1).Select
End Sub

Download Excel Macro File

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...