Lux Aeterna
Board Regular
- Joined
- Aug 27, 2015
- Messages
- 205
- Office Version
- 2019
- Platform
- Windows
Hello everyone!
I've got this macro and I'd like the excel file to be autosaved after it's excecuted.
What command should I use and where I do I have to add it?
Successful use of the command ends here
All the other are warning messages.
Thank you!
I've got this macro and I'd like the excel file to be autosaved after it's excecuted.
VBA Code:
Sub ÁðïèÞêåõóç()
Application.ScreenUpdating = False
Dim ID As Range, sup As String, sID As String
If Sheets("Test pap").Range("U2") = "" Then
MsgBox ("Ôï ID äåí ìðïñåß íá åßíáé êåíü.")
Sheets("Test pap").Range("U2").Select
Exit Sub
End If
If Sheets("Test pap").Range("U3") = "" Then
MsgBox ("Ôï êßôñéíï êåëß äåí ìðïñåß íá åßíáé êåíü.")
Sheets("Test pap").Range("U3").Select
Exit Sub
End If
Set ID = Sheets("List" & Range("Y2").Value).Range("A:A").Find(Sheets("Test pap").Range("U2").Value, LookIn:=xlValues, lookat:=xlWhole)
If Not ID Is Nothing Then
If ID.Offset(, 1) <> "" Then
If MsgBox("Ôï áðïôÝëåóìá Ý÷åé Þäç äïèåß áðü " & ID.Offset(, 37) & "." & Chr(10) _
& "Èåò ïðùóäÞðïôå íá ôï áíôéêáôáóôÞóåéò;", vbYesNo + vbDefaultButton2) = vbYes Then
ID.Offset(, 1) = Sheets("Test pap").Range("AB9")
ID.Offset(, 38) = Sheets("Test pap").Range("A45")
ID.Offset(, 39) = Sheets("Test pap").Range("A46")
Else
Sheets("Test pap").Range("U2:X3").ClearContents
Sheets("Test pap").Range("U2:X2").Select
MsgBox ("Âåâáéþóïõ üôé ôá óôïé÷åßá ðïõ êáôá÷þñçóåò áöïñïýí ôï óùóôü äåßãìá! Áí ü÷é, ðÜôá êáèáñéóìü!")
Exit Sub
End If
Else
ID.Offset(, 1) = Sheets("Test pap").Range("AB9")
ID.Offset(, 38) = Sheets("Test pap").Range("A45")
ID.Offset(, 39) = Sheets("Test pap").Range("A46")
End If
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:="C:\Users\pc50\Desktop\New results\" & Range("AH1").Value _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
Else
MsgBox ("Ôï ID " & Sheets("Test pap").Range("U2") & " äåí õðÜñ÷åé óôç ëßóôá ôùí ñáíôåâïý " & Sheets("Test pap").Range("Y2") & "." & Chr(10) & "¸ëåãîå üôé Ýâáëåò ôï óùóôü Ýôïò êáé ôï óùóôü ID.")
Sheets("Test pap").Range("U2:X3").ClearContents
Sheets("Test pap").Range("U2:X2").Select
Exit Sub
End If
Application.ScreenUpdating = True
End Sub
What command should I use and where I do I have to add it?
Successful use of the command ends here
Else
ID.Offset(, 1) = Sheets("Test pap").Range("AB9")
ID.Offset(, 38) = Sheets("Test pap").Range("A45")
ID.Offset(, 39) = Sheets("Test pap").Range("A46")
End If
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:="C:\Users\pc50\Desktop\New results\" & Range("AH1").Value _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
All the other are warning messages.
Thank you!