Option Explicit
Sub saveasPDF()
Dim LR As Long
If MsgBox("Sei sicuro di voler stampare in pdf il registro?", vbOKCancel + vbQuestion, "STAMPA REGISTRO") = vbCancel Then Exit Sub
Application.EnableEvents = False
With Sheets("REGISTRO TELEFONATE")
LR = .Cells(.Rows.Count, "A").End(xlUp).Row
.PageSetup.PrintArea = "A1:F" & LR
.ExportAsFixedFormat xlTypePDF, "C:UsersSilvia&AleDesktopRegistro Telefonate"
.Range("A3").Select
End With
MsgBox "Registro salvato correttamente", vbInformation + vbOKOnly, "Salva registro"
Application.EnableEvents = True
End Sub
Sub automatic_saveasPDF()
Dim LR As Long
Application.EnableEvents = False
With Sheets("REGISTRO TELEFONATE")
LR = .Cells(.Rows.Count, "A").End(xlUp).Row
.PageSetup.PrintArea = "A1:F" & LR
.ExportAsFixedFormat xlTypePDF, "C:UsersSilvia&AleDesktopRegistro Telefonate" & " " & "del" & " " & Format(DateAdd("d", -1, Now), "DD-MM-YYYY.pdf")
.Range("A3:F5000").ClearContents
.Range("A3").Select
End With
Sheets("ELENCO TELEFONICO").Select
Range("A3").Select
Application.EnableEvents = True
End Sub
Sub Fondo()
Application.EnableEvents = False
With Range("A3:H1117").Font
With .Font
.Name = "Comic Sans MS"
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16777216
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = True
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A3").Select.Select
Application.EnableEvents = True
End Sub
Sub ordina()
Application.EnableEvents = False
With Sheets("ELENCO TELEFONICO").Sort
With .SortFields
.Clear
.Add Key:=Range("B3"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
End With
.SetRange Range("A2:H1117")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
If .FilterMode = True Then .ShowAllData
End With
Range("A3").Select
Application.EnableEvents = True
End Sub
|