- 帖子
- 22
- 积分
- 211
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2009-1-20
|
代码功能:查找指定EXCEL,最大行、最大列中值为空单元格,并替换为 "0"。如数据量大时,效率太点低,恳请各位老师指正。
Dim xlApp,xlSheet,xlWorkBook
Dim iRowCount,iLoop,jLoop,jColumnCount,numAdd
Set xlApp=CreateObject("Excel.Application")
xlApp.Visible=True
Set xlWorkBook=xlApp.Workbooks.Open("d:11.xls")
Set xlSheet=xlWorkBook.Sheets("Sheet1")
iRowCount=xlSheet.UsedRange.Rows.Count
jColumnCount=xlSheet.UsedRange.Columns.Count
For iLoop= 1 To iRowCount
For jLoop= 1 To jColumnCount
If Len(xlSheet.cells(iLoop,jLoop).value) <1 Then
xlSheet.cells(iLoop,jLoop).value=0
End if
Next
Next
xlWorkBook.Save
xlWorkBook.Close
xlApp.Quit |
|