我有一個函數將range.address存儲在單元格中。 該單元格的值是IE:AQ43:BF44Excel VBA - 將字符串轉換爲範圍
如何將此字符串轉換爲Range?
我曾嘗試:
Dim Cell As Range
Dim pRange As String
Dim projectRange As Range
pRange = Project.Range ' Stored as "AQ43:BF44" in this case
projectRange = Range(pRange)
For Each Cell In projectRange
If TargetCell = Cell Then
'Do something
End If
Next Cell
此代碼報告運行時錯誤91:未設置對象變量或與塊變量。
該函數的主要目的是檢查targetCell(單元格是否是doubleclicked)在存儲的range.address中被找到。
'普蘭奇= projectRange.Value'而不是'普蘭奇= Project.Range' – Rory