過了一段時間,因爲我已經完成了一些編程工作,並且我沒有使用簡單的excel vba宏。我有一列的數據,我需要選擇然後刪除不包含特定值的單元格。我的數據是這樣的一列:在Excel中搜索列,找到值,選擇並刪除
990ppbAu/1,2
990ppbAu/0,5
990ppbAu/0,5
990ppbAu/0,3
9900ppmZr/29,1
9900ppmZn/5,2
9900ppmZn/1
9900ppmZn/0,8
9900ppmZn/0,5
9900ppmCu/2,8
我需要刪除該值或STRI在他們中不包含「Au」的ngs。這裏是我的代碼的開始,這不是很多,可能是錯的......但我希望有人能指出我在正確的方向:
Option Explicit
Sub SearchColumn()
Dim strAu As String
Dim rngFound, rngDelete As Range
strAu = "*Au*"
'Search Column
With Columns("AF")
'Find values without "Au" in string in column AF and delete.
Set rngFound = .Find(strAu, .Cells(.Cells.Count), xlValues, xlWhole)
If rngFound <> strAu
'Then select the value and delete
'Else move onto the next cell until end of the document
End With
End Sub
我應該注意到,一些細胞有沒有在其中,而有些具有如上所示的字符串值。我需要它貫穿整個專欄直到文檔結束。表中有大約115,000條記錄。提前致謝!
是否要刪除單元格的內容或單元格本身(以便所有其他值都向上移動)? –
只是單元格的內容。沒有任何其他值的移動 –