MS Access VBA如何在Excel中删除一行 [英] MS Access VBA How to delete a row in Excel
本文介绍了MS Access VBA如何在Excel中删除一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码在MS Access 2003中打开一个Excel文件。
我想删除第2行或A2:K2。
I have used the below code to open an Excel file in MS Access 2003. I would like to delete row 2 or A2:K2.
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open "QuotebyItem.xls", True, False
推荐答案
Dim wb as Excel.Workbook
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set wb = xlApp.Workbooks.Open("QuotebyItem.xls", True, False)
wb.Sheets(1).Rows(2).Delete
...假设你文件只有一个工作表:如果可能有多个,您只需要处理其中一个:
...assuming your file has only one sheet: if there might be multiple and you need to address only one of them:
wb.Sheets("Sheet2").Rows(2).Delete
这篇关于MS Access VBA如何在Excel中删除一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文