Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Workbook_BeforeClose _
- (Cancel As Boolean)
- Dim ws As Worksheet
- Dim Resp As Long
- Dim ShowCount As Long
- ShowCount = 0
- For Each ws In ThisWorkbook.Worksheets
- If UCase(Left(ws.Name, 4)) = "HOJA" Then
- ShowCount = ShowCount + 1
- End If
- Next ws
- If ShowCount > 0 Then
- Resp = MsgBox("Desea Borrar las Hojas de detalle??", _
- vbYesNo, "Borrar Hojas?")
- If Resp = vbYes Then
- Application.DisplayAlerts = False
- For Each ws In ThisWorkbook.Worksheets
- If UCase(Left(ws.Name, 4)) = "HOJA" Then
- ws.Delete
- End If
- Next ws
- End If
- End If
- Set ws = Nothing
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement