目录中的数百个xlsx文件将导入MS Access 2010数据库。
我在导入之前要清理工作表。
问题是:如何删除A列中没有数据的所有行以及从O到XFD的所有列?
必须删除所有红色。
Private Sub Comand_Click()
Dim FullPath As String
Dim oXL As Object, oWb As Object, oWs As Object
FullPath = "D:\Access\_Test_XlsImport\FileName.xlsx"
Set oXL = CreateObject("Excel.Application")
Set oWb = oXL.Workbooks.Open(FullPath)
Set oWs = oWb.Sheets("Worksheet_name")
oXL.Visible = True
With oWs
.Columns("O:XFD").Delete
.Rows("xx:xx").Delete ' <---problem to identify the starting point to delete below..
End With
oWb.Save
CleanUp:
oWb.Close False
oXL.Quit
Set oWb = Nothing
Set oXL = Nothing
Set oWs = Nothing
End Sub