AS
VBA per Microsoft Excel
Formattazione, adatta colonne, blocca celle, rimuovi formattazione
Formato numero, formato valuta, formato percentuale.
Public Sub FormatoNumero()
Selection.NumberFormat = "#,##0"
End Sub
Public Sub FormatoValuta()
Selection.NumberFormat = "$ #,##0"
End Sub
Public Sub FormatoPercentuale()
Selection.Style = "Percent"
End Sub
Adatta colonne e blocca celle orizzontale.
Public Sub AdattaColonne()
Cells.EntireColumn.AutoFit
End Sub
Public Sub BloccaOrizz()
ActiveWindow.FreezePanes = False
'reset evtl blocchi precedenti
ActiveWindow.FreezePanes = True
End Sub
Questa funzione fa una pulizia della formattazione, eliminando eventuali bordi, allineamenti e colori.
Public Function sheetClear(myWorkbook As Workbook, mySheet As String)
With myWorkbook.Worksheets(mySheet)
.Cells.EntireColumn.AutoFit
.Cells.Borders.LineStyle = xlNone
.Cells.HorizontalAlignment = xlGeneral
.Cells.Interior.Pattern = xlNone
.Cells.Interior.TintAndShade = 0
.Cells.Interior.PatternTintAndShade = 0
.Cells.Font.ColorIndex = xlAutomatic
.Cells.Font.TintAndShade = 0
End With
End Function