I'm creating and manipulating an Excel spreadsheet from within my VB.net program. I'm using these imports:
I'm creating these objects:
Initializing them:
After writing to the cells I'm sorting like this:
Everything works fine at this point. I've made some of the cells background color green in column H and now I want to sort on the cell background color. What is the code to accomplish that?
Code
Imports Microsoft.Office.Interop.Excel
Imports Excel = Microsoft.Office.Interop.ExcelI'm creating these objects:
Code
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As ObjectInitializing them:
Code
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
oSheet = oBook.Worksheets(1)After writing to the cells I'm sorting like this:
Code
myRange = oSheet.Range("A2", "H50" )
myRange.Select()
myRange.Sort(Key1:=myRange.Range("f1"), Order1:=XlSortOrder.xlDescending, Orientation:=XlSortOrientation.xlSortColumns)Everything works fine at this point. I've made some of the cells background color green in column H and now I want to sort on the cell background color. What is the code to accomplish that?



