我试图在Excel工作表中调整宏,以便在列AC =" FT"然后应该清除AD和AE。
我试过寻找答案但却找不到有效的方法。
由于
答案 0 :(得分:2)
如果我正确理解了您的问题,请在您放置数据的工作表代码模块中尝试以下代码。
Sub Test()
Dim i As Long, LastRow As Long
LastRow = Cells(Rows.Count, "AC").End(xlUp).Row
For i = 1 To LastRow 'Set the value of i as a starting point depends on your first data is located
If Cells(i, "AC").Value = "FT" Then
Range(Cells(i, "AD"), Cells(i, "AE")).Clear 'Alternatively .Value = "" or .ClearContents
End If
Next i
End Sub