| | Post: 128 | Registrato il: 17/07/2011
| Età: 27 | Utente Junior | excel 2000/2007 | | OFFLINE | |
|
25/11/2016 20:00 | |
Ciao a tutti,
come posso unire queste 2 macro:
Sub rimetti_colore_1() 'rimette il colore
ActiveSheet.Unprotect "123456"
Range( _
"A1:C2,D1:F1,J1,M1:P1,D2:E2,A3:B3,A4:B4,G3:J3,L5:M5,A5:A6,B5:K6,A32:B32,A33:B33,A34:B34,I32:J32,I33:J33,I34:J34,A35:P35" _
).Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Range("G1").Select
ActiveSheet.Protect "123456"
End Sub
Sub rimetti_colore_2() 'rimette il colore
ActiveSheet.Unprotect "123456"
Range("G1:I1,K1:L1,N5:P5").Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Range("G1").Select
ActiveSheet.Protect "123456"
End Sub
la macro1 rimette il colore celeste, la macro2 rimette il colore rosso nei propri range.
igor
excel 2007 |
|
| | Post: 1.015 | Registrato il: 06/04/2013
| Utente Veteran | 2010 | | OFFLINE |
|
25/11/2016 20:13 | |
Ciao
non sembra complesso:
Sub colore()
ActiveSheet.Unprotect "123456"
Range( _
"A1:C2,D1:F1,J1,M1:P1,D2:E2,A3:B3,A4:B4,G3:J3,L5:M5,A5:A6,B5:K6,A32:B32,A33:B33,A34:B34,I32:J32,I33:J33,I34:J34,A35:P35" _
).Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Range("G1:I1,K1:L1,N5:P5").Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Range("G1").Select
ActiveSheet.Protect "123456"
End Sub
Saluti
Domenico
Win 10 - Excel 2016 |
| | Post: 3.476 | Registrato il: 13/03/2012
| Città: LIVORNO | Età: 78 | Utente Master | 2010 | | OFFLINE | |
|
25/11/2016 20:14 | |
spero che ti mangerai le mani dopo aver visto la soluzione
Sub rimetti_colore_1() 'rimette il colore
ActiveSheet.Unprotect "123456"
Range( _
"A1:C2,D1:F1,J1,M1:P1,D2:E2,A3:B3,A4:B4,G3:J3,L5:M5,A5:A6,B5:K6,A32:B32,A33:B33,A34:B34,I32:J32,I33:J33,I34:J34,A35:P35" _
).Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Range("G1:I1,K1:L1,N5:P5").Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
ActiveSheet.Protect "123456"
End Sub
----------
Win 10 - Excel 2010
allega un file di esempio, guadagnerai tempo tu e lo farai risparmiare a chi ti aiuta |
| | Post: 128 | Registrato il: 17/07/2011
| Età: 27 | Utente Junior | excel 2000/2007 | | OFFLINE | |
|
25/11/2016 20:35 | |
Grazie dodo e patel,
è o.k.
igor
excel 2007 |
|
|