I have sheet with name LIST, and in cell K15 is some value. What i need is for macro to check all other sheets and if it match value from (LIST) - (K15) to cell (B4) on all other sheets in workbook, and it will be always that place (B4). If it get match then delete that sheet.
So it is some kind of match loop macro.
Please help me
Sub DeleteSheets01()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If Worksheets("LIST").Range("K15") = LenB(ActiveSheet.Range("B4")) Then ActiveSheet.Delete
Next ws
End Sub
I have done it
Sub DeleteSheets01()
Application.DisplayAlerts = False
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("B4") = Worksheets("LIST").Range("K15") Then
ws.Delete
End If
Next ws
Application.DisplayAlerts = True
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.