Compare by cells
Set objexcel=createobject("excel.application")
objexcel.visible=true
Set sac1=objexcel.workbooks.open("E:\sac1")
Set sac2=objexcel.workbooks.open("E:\sac2")
Set sh1=sac1.worksheets(1)
Set sh2=sac2.worksheets(1)
For each cell in sh1.usedrange
If cell.value<>sh2.range(cell.address).value Then
cell.interior.colorindex=6
else
cell.interior.colorindex=0
End If
Next
Search Particular
value
Set objexcel=createobject("excel.application")
Set obj=objexcel.workbooks.open("E:\sac1.xls")
With obj.worksheets(1).usedrange
Set c=.find("12")
For each c in obj.worksheets(1).usedrange
If c="12" Then
c.interior.colorindex=40
else
Set c=.findnext(c)
End If
Next
End with
Sorting By Column
Const xlDescending = 1
Const xlYes = 1
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook =
objExcel.Workbooks.Open("E:\sac1.xls")
Set objWorksheet = objWorkbook.Worksheets(1)
Set objRange = objWorksheet.UsedRange
Set objRange2 = objExcel.Range("A1")
objRange.Sort objRange2,xlDescending
set objExcel=nothing
No comments:
Post a Comment