vfp如何删除Excel中的空白行?
如题
手工删除,找百度咨询
oExcel = CREATEOBJECT('Excel.Application') WITH oExcel .Workbooks.Add(-4167) * 添加测试数据 .ActiveSheet.Cells(2, 2).Value = "abcd" .ActiveSheet.Cells(4, 4).Value = "abcd" .ActiveSheet.Cells(6, 6).Value = "abcd" .ActiveSheet.Cells(10, 10).Value = "ABCD" *删除空白行 lnRow = .ActiveSheet.UsedRange.Rows.Count FOR lnj = lnRow TO 1 STEP - 1 IF .WorksheetFunction.CountA(.Rows(lnj)) = 0 .Rows(lnj).Delete ENDIF ENDFOR *删除空白列 lnCol = .ActiveSheet.UsedRange.Columns.Count FOR lnj = lnCol TO 1 STEP - 1 IF .WorksheetFunction.CountA(.Columns(lnj)) = 0 .Columns(lnj).Delete ENDIF ENDFOR .Visible = .T. ENDWITH
[此贴子已经被作者于2021-6-2 07:08编辑过]