Hi Guys, would you please help.
I'd this workbook event before and it was working just fine
However, I needed to proceed with some changes for the event, yet, it doesn't work for closing part anymore:
How I could sort this out?
Another point, I'd like to add part for this event to run the first part only if the active sheet name is one of the available names in Worksheets("DB").Range("A1:A100"), otherwise, to just save and close, is it doable?
I'd this workbook event before and it was working just fine
Code:
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
If Success Then
ThisWorkbook.Close
End If
End Sub
However, I needed to proceed with some changes for the event, yet, it doesn't work for closing part anymore:
Code:
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
Dim i As Long
i = ActiveCell.Column
Cells(Range("A65536").End(xlUp).Row + 1, 1).Select
ActiveCell.Resize(2).EntireRow.Copy Sheets("Report").Range("A" & Rows.Count).End(xlUp).Offset(1)
ActiveCell.Offset(0, 11).Value = Format(Now(), "dd/mm/yyyy")
ActiveCell.Offset(0, 12).Value = Format(Now(), "hh:nn:ss")
If Success Then
ThisWorkbook.Close
End If
End Sub
How I could sort this out?
Another point, I'd like to add part for this event to run the first part only if the active sheet name is one of the available names in Worksheets("DB").Range("A1:A100"), otherwise, to just save and close, is it doable?