【发布时间】:2015-09-02 19:26:56
【问题描述】:
我正在编写一个 VbScript 来删除通过参数放入的 excel 文件中的特定列。 excel 文件的第 1 行是列的标题。这是我当前在标题中查找特定字符串的代码。
Set objExcel = CreateObject("Excel.Application")
If WScript.Arguments.Count = 0 Then
WScript.Echo "Drop excel files on this script"
Else
objExcel.Visible = True
objExcel.Workbooks.Add(WScript.Arguments.Item(0))
Set FoundCell = objExcel.Range("A1:C1").Find("Sales Figures")
'* Select the entire column of FoundCell and remove it
End If
我的第一个问题是我必须手动指定要搜索的标题范围 (A1:C1)。有什么方法可以自动执行 (A1:X1) - 其中 X 是 excel 表中的最后一列。
第二,我怎样才能删除 FoundCell 的整个列?
【问题讨论】: