Microsoft Excel: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m Ripristino alla versione 5634725 datata 2006-11-28 23:09:48 di Snowdog tramite popup
Riga 92:
 
Per chi usa le [[macro]] per la prima volta o per chi non ha voglia di impararsi a memoria i nomi di tutti gli oggetti, le proprietà e i metodi di Excel, esiste la possibilità di registrare una [[macro]]. Registrare una macro significa registrare una serie di comandi di Excel e trasformarli in una macro. Questi comandi verranno poi ripetuti automaticamente quando si lancia la macro. Per registrare una macro selezionare il menu ''Tools/Macro/Record New Macro''.
 
 
Propongo due varianti alla macro sopra esposta
 
Francesco Galli e-mail gkaug@tin.it
 
Public Sub Macro3_Variante1()
Dim z As Integer
Dim i(51) As Integer
Dim k As Integer
Dim j As Integer
Dim y As Integer
Dim c As Integer
Cells.Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Columns("A:AZ").ColumnWidth = 2.71
ActiveCell.Select
For z = 1 To 32000
y = Int(Rnd() * 50 + 1)
k = Int(Rnd() * 255 + 1)
c = Int(Rnd() * 50 + 1)
ActiveSheet.Cells(i(y) + 1, y).Select
Selection.Font.ColorIndex = c
Selection.Font.Bold = True
Selection.Value = Chr(k)
i(y) = i(y) + 1
Next z
End Sub
 
Public Sub Macro3_Variante2()
Dim z As Integer
Dim i(51) As Integer
Dim k As Integer
Dim j As Integer
Dim y As Integer
Cells.Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Columns("A:AZ").ColumnWidth = 2.71
ActiveCell.Select
For z = 1 To 32000
y = Int(Rnd() * 50 + 1)
k = Int(Rnd() * 255 + 1)
ActiveSheet.Cells(i(y) + 1, y).Select
Selection.Font.ColorIndex = y
Selection.Font.Bold = True
Selection.Value = Chr(k)
i(y) = i(y) + 1
Next z
End Sub
 
==Estensioni==