[英]Clear contents of any cell in column that contain a double quote in the text string
我需要清除K
列中任何在文本字符串中包含雙引號( "
)的單元格的內容。文本字符串會有所不同,有些會說3" hose
,有些會說10" road
所以它不會是相同,只是在該列中,我需要清除單元格的內容(不刪除,我不希望其余數據移動)。
這是我嘗試過的:
Sub Macro4()
Rows("3:3").Select
Selection.AutoFilter
Range("K2").Select
ActiveSheet.Range("$A$3:$V$3225").AutoFilter Field:=11, Criteria1:="=*""*" _
, Operator:=xlAnd
Range("K45").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Rows("3:3").Select
Range("E3").Activate
Selection.AutoFilter
Range("A4").Select
End Sub
答案發表在評論中:
Columns("K:K").Select
Selection.Replace What:="''", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
雖然您永遠不要使用.Select
所以我會使用:
Columns("K:K").Replace What:="''", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.