簡體   English   中英

Excel:獲取包含某些文本或公式的單元格的單元格集合

[英]Excel: get cell collection of cells that contain certain text or formula

我有一個包含1個或更多工作表的工作表,每個工作表有很多填充的單元格。 我需要遍歷具有特定文本和/或公式的所有單元格。

(在.NET中)最快的方法是什么?

在VBA,VB.NET或C#中的示例將不勝感激。

將此宏粘貼到工作簿中的宏編輯器中(ALT + F11)

Sub test()
  Dim w As Worksheet, r As Range
  For Each w In ThisWorkbook.Worksheets
    For Each r In w.UsedRange
        If r.Value = "Certain text" Or r.Formula = "Certain Formula" Then
            'Do what you want to do here
        End If
    Next
  Next
End Sub

希望這可以幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM