1
我是新來vba
編程和目前正在研究以下內容:數據刪除匹配項的字符串在VBA
- 記錄屬性名稱,並將其記錄到
AttributeName()
- 要求用戶選擇目標/從屬變量
- 刪除目標從
AttributeName()
我有問題進行步驟3的屬性(I使用Filter()
和.Delete
)
Dim DataRange As Range
Dim nrow As Long
Dim ncol As Long
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Set DataRange = Selection
nrow = DataRange.Rows.Count
ncol = DataRange.Columns.Count
Dim AttributeName() As String
For i = 1 to ncol
ReDim Preserve AttributeName(i)
AttributeName(i) = Sheets("data").Cells(1,i).Value
Next i
Dim TargetRange as Range
Dim Target as String
Set TargetRange = Application.InputBox("Please highlight the cell for TARGET", Type:=8)
Target = TargetRange.Value
我的想法是:
If AttributeName(i) = Target Then ...
謝謝你的溫柔的幫助。
Simoco嗨!非常感謝!
它很完美!採集! – useR