Hello,
I have a macro, activated by button click, that moves the entire row to another sheet ("Archive") if cell value in column F is "Finalised". Macro works fine.
I want to add message after it finishes with information how many rows have been moved. The problem i am encountering is that it always show 0. Hoped CStr() will fix it, but no success.
Thanks in advance.
I have a macro, activated by button click, that moves the entire row to another sheet ("Archive") if cell value in column F is "Finalised". Macro works fine.
I want to add message after it finishes with information how many rows have been moved. The problem i am encountering is that it always show 0. Hoped CStr() will fix it, but no success.
Code:
Sub Update() 'moving finalised projects to archive
Dim Check As Range, r As Long, lastrow2 As Long, lastrow As Long, status As Integer
Application.EnableEvents = False
Application.ScreenUpdating = False
status = Application.WorksheetFunction.CountIf(Range("F3:F100"), "Finalised") 'count finalised projects moved to archive
lastrow = Worksheets("VAT registrations").UsedRange.Rows.Count
For r = lastrow To 2 Step -1
If Worksheets("VAT registrations").Range("F" & r).Value = "Finalised" Then
Worksheets("VAT registrations").Rows(r).Cut Destination:=Worksheets("Archive").Range("A" & Rows.Count).End(xlUp)(2)
Worksheets("VAT registrations").Rows(r).Delete
End If
Next r
Application.EnableEvents = True
Application.ScreenUpdating = True
MsgBox "File updated, projects moved to archive: " & CStr(status)
End Sub
Thanks in advance.