|
楼主 |
发表于 2016-7-10 17:18:46
|
显示全部楼层
以下代码可以实现变成时间格式,还有更好办法吗?
Local $oExcel = _Excel_Open()
Local $oWorkbook = _Excel_BookOpen($oExcel, "R:\test.xlsx")
_Excel_RangeInsert($oWorkbook.Activesheet, "M:N")
Local $aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:A"), 1)
_Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, '=IF(O2<>"",TEXT(O2,"HH:MM"),"")', "M2:M" & UBound($aResult), False)
_Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, '=IF(P2<>"",TEXT(P2,"HH:MM"),"")', "N2:N" & UBound($aResult), False)
With $oWorkbook.Activesheet
$aArray = $oWorkbook.Parent.Application.Intersect(.Range(.Cells(2, 14), .Cells(.Rows.Count, 1)), .Usedrange).Value
$aArray = $oWorkbook.Parent.Application.Transpose($aArray)
EndWith
_ArrayDisplay($aArray) |
|