
For CELLA = 1 To 18
ActiveCell.Select
ActiveCell.ClearContents
'...
Next CELLA |
Option Explicit
Sub richiamo()
Dim i As Long
For i = 9 To 16
Call letueoperazioni(Cells(i, 3))
Next i
Call letueoperazioni([C6])
Call letueoperazioni([D6])
End Sub
Sub letueoperazioni(ByVal Cella As Range)
Cella.Interior.ColorIndex = 1
Cella.Font.Bold = True
''ecc
''ecc
End Sub |
Option Explicit
Sub celle()
With Range("C6, D6, C9, c10, c11, c12, c13, c14, c15, c16, B19, C19, B22, C22, B28, C28, B31, C31")
.ClearContents
End With
End Sub |
Sub SCOLORA_CELLA()
'Elimino il colore della cella
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub
LISTA_NON_DISPONIBILE:
With Selection.Validation
.Delete
.Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="NON DISPONIBILE"
.IgnoreBlank = True
.InCellDropdown = True
.ErrorMessage = "NON DISPONIBILE"
.ShowInput = True
.ShowError = True
End With |
PRIMA VERSIONE:
Sub All_In()
With Range("C6, D6, C9, c10, c11, c12, c13, c14, c15, c16, B19, C19, B22, C22, B28, C28, B31, C31")
With .Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With .Validation
.Delete
.Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="NON DISPONIBILE"
.IgnoreBlank = True
.InCellDropdown = True
.ErrorMessage = "NON DISPONIBILE"
.ShowInput = True
.ShowError = True
End With
End With
End Sub
SECONDA VERSIONE, DUE SUB DIPENDENTI:
Sub A_Pezzi()
Call Pezzettoni(Range("C6, D6, C9, c10, c11, c12, c13, c14, c15, c16, B19, C19, B22, C22, B28, C28, B31, C31")) 'anche una cella alla volta
End Sub
Private Sub Pezzettoni(ByVal Cella As Range)
With Cella
With .Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With .Validation
.Delete
.Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="NON DISPONIBILE"
.IgnoreBlank = True
.InCellDropdown = True
.ErrorMessage = "NON DISPONIBILE"
.ShowInput = True
.ShowError = True
End With
End With
End Sub
|
For Each cell In Range("C6, D6, C9, c10, c11, c12, c13, c14, c15, c16, B19, C19, B22, C22, B25, C25,B28, C28, B31, C31")
cell.Select
cell.ClearContents
SCOLORA_CELLA
LISTA_NON_DISPONIBILE
Next cell |
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
With Range("C6, D6, C9, c10, c11, c12, c13, c14, c15, c16, B19, C19, B22, C22, B28, C28, B31, C31")
With .Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With .Validation
.Delete
.Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="NON DISPONIBILE"
.IgnoreBlank = True
.InCellDropdown = True
.ErrorMessage = "NON DISPONIBILE"
.ShowInput = True
.ShowError = True
End With
End With
End Sub
|
