sembra che il problema si presenti sempre
dopo aver premuto "colora"
oppure maiusc fogl.2
Moderatori: Anthony47, Flash30005
Sub colorarighe()
ActiveSheet.Unprotect
UserForm3.Show vbModeless
DoEvents
Range("b2:h1000").Interior.ColorIndex = 2 '<<< qui colora una riga
For RR = 2 To 1000 Step 2
Range("b" & RR & ":h" & RR).Interior.ColorIndex = 36
Next RR
ActiveWindow.DisplayGridlines = False ' tolgo la griglia di sfiondo
Columns("a:h").EntireColumn.AutoFit ' adatto la larghezza delle colonne
Cells.Rows.AutoFit
Sheets("Foglio2").Select
ActiveSheet.Unprotect
Range("a2:d1000").Interior.ColorIndex = 2 '<<< qui colora una riga
For RR = 2 To 1000 Step 2
Range("a" & RR & ":d" & RR).Interior.ColorIndex = 36
Next RR
Range("E2:I1000").Select 'serve a colorare solo nel caso si siano colorate queste righe x errore
Selection.Interior.ColorIndex = 2
Range("a2").Select
ActiveWindow.DisplayGridlines = False
Columns("a:d").EntireColumn.AutoFit ' adatto la larghezza delle colonne
Cells.Rows.AutoFit
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingColumns:=True, AllowFormattingRows:=True
Sheets("Foglio1").Select
Columns("B:B").ColumnWidth = 60.2 'adatto larghez col titolo
Range("a2").Select
Range("I2").Select 'metto numeri x settare il foglio da stampare
ActiveCell.FormulaR1C1 = "1"
Range("I3").Select
ActiveCell.FormulaR1C1 = "=R[-1]C+1"
Range("I3").Select
Selection.AutoFill Destination:=Range("I3:I1000"), Type:=xlFillDefault
Range("I3:I1000").Select
Range("l2").Select 'metto i numeri x sapere quanti con stesso numero
ActiveCell.FormulaR1C1 = "1"
Range("l3").Select
ActiveCell.FormulaR1C1 = "=R[-1]C+1"
Range("l3").Select
Selection.AutoFill Destination:=Range("l3:l1000"), Type:=xlFillDefault
Range("l3:l1000").Select
Range("A2").Select
Unload UserForm3
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingColumns:=True, AllowFormattingRows:=True
End Sub
Sub tuttomaiusc1()
ActiveSheet.Unprotect
UserForm3.Show vbModeless
DoEvents
Range("a2").Select
Application.EnableEvents = False '<<< metto tutto maiuscolo le col
Application.Calculation = xlManual
Dim CL As Range
For Each CL In ActiveSheet.Range("b2:g1000")
If CL.HasFormula = False Then
CL.Value = UCase(CL.Value)
End If
Next CL
Calculate
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Range("a2").Select
Unload UserForm3
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingColumns:=True, AllowFormattingRows:=True
End Sub
Sub tuttomaiusc2()
ActiveSheet.Unprotect
UserForm3.Show vbModeless
DoEvents
Sheets("Foglio2").Select
ActiveSheet.Unprotect
Range("a2").Select
Application.EnableEvents = False '<<< metto tutto maiuscolo le col
Application.Calculation = xlManual
Dim CL As Range
For Each CL In ActiveSheet.Range("a2:d1000")
If CL.HasFormula = False Then
CL.Value = UCase(CL.Value)
End If
Next CL
Calculate
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Range("a2").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingColumns:=True, AllowFormattingRows:=True
Sheets("Foglio1").Select
Range("a2").Select
Unload UserForm3
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingColumns:=True, AllowFormattingRows:=True
End Sub
Sub tuttomaiusc2()
Sheets("Foglio2").Select
ActiveSheet.Unprotect
UserForm3.Show vbModeless
DoEvents
Range("a2").Select
Application.EnableEvents = False '<<< metto tutto maiuscolo le col
Application.Calculation = xlManual
Dim CL As Range
For Each CL In ActiveSheet.Range("a2:d1000")
If CL.HasFormula = False Then
CL.Value = UCase(CL.Value)
End If
Next CL
Calculate
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Range("E2:I1000").Select 'serve a colorare solo nel caso si siano colorate queste righe x errore
Selection.Interior.ColorIndex = 2
Range("a2").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingColumns:=True, AllowFormattingRows:=True
Sheets("Foglio1").Select
Range("a2").Select
Unload UserForm3
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingColumns:=True, AllowFormattingRows:=True
End Sub
If CL.HasFormula = False Then
If Len(CL.Value) <> 0 Then
CL.Value = UCase(CL.Value)
Else: CL.ClearContents
End If
End If
Columns("a:h").EntireColumn.AutoFit ' adatto la larghezza delle colonne
Cells.Rows.AutoFit
Columns("A:H").ColumnWidth = 15
Largh = Array(15, 50, 10, 30, 10, 10, 8, 10) 'Larghezza fissa delle col A:H
For I = 1 To 8
Cells(1, I).ColumnWidth = Largh(I - 1)
Next I
Range("A2:A1000").RowHeight = 23
Private Sub CommandButton3_Click()
...
Label22.Caption = x - 1
...
Private Sub UserForm_Initialize()
...
Label22.Caption = x - 1
...
Torna a Applicazioni Office Windows
Visitano il forum: Nessuno e 99 ospiti