[英]Clear Macro to clear specific range of cells on Blank cell in certain column
[英]Excel Macro - making next 2 cells blank if cell has a certain value
我正在嘗試在Excel工作表中調整宏,以便如果AC =“ FT”列,則應清除AD和AE。
我嘗試尋找答案,但找不到任何有效的方法。
謝謝
如果我正確理解了您的問題,請在放置數據的工作表代碼模塊中嘗試以下代碼。
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.