|
本帖最后由 361553894 于 2015-12-4 12:58 编辑
Set oExcel = CreateObject("Excel.Application.11")
path = "D:/working/LH/"
myDate= Right("000" & Year(Date),4) & Right("0" & Month(Date),2) & Right("0" & Day(Date),2)
myTime= Right("0" & Hour(Time),2) & Right("0" & Minute(time),2) & Right("0" & Second(time),2)
name = path & myDate & "-" & myTime & "-NetLengthToExcel_U"
NetLengthUpdate name
Sub NetLengthUpdate(name)
With oExcel
.Visible=True
.Caption="NetLengthUpdate"
.Workbooks.Open("D:/working/LH/20151203-125756-NetLengthToExcel.xls")
.WorkSheets("Data").Activate
maxrow = .WorkSheets("Data").UsedRange.Rows.Count
.Cells.NumberFormatLocal = "0.00_ "
.Range("E4:E" & maxrow).Select
' Selection.FormatConditions.Delete
' Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$E$5>3000"
' Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$E$5>3000"
' Selection.FormatConditions(1).Font.ColorIndex = 3
' Selection.FormatConditions(2).Font.ColorIndex = 4
End With
End Sub
Selection.FormatConditions.Delete这条是能执行的
关键是FormatConditions.Add 不管怎么改都说格式错误
|
|