我正在尝试编写一个宏来从电子表格中删除具有某些内容的列。所有数据都在第一行,长度可变。我认为问题可能与我的范围选择有关。当我尝试进行搜索时,下标总是超出范围。任何意见,将不胜感激。:)
Sub Disk_Firmware()
Dim c As Range
Dim SrchRng As Range
Dim SrchStr As String
Set SrchRng = ActiveSheet.Range("A1").EntireRow
SrchStr = InputBox("Please enter a search string")
Do
Set c = SrchRng.Find(SrchStr, LookIn:=xlvalues)
If Not c Is Nothing Then c.EntireColumn.Delete
Loop While Not c Is Nothing
End Sub