|
| HOMEPAGE | INDICE FORUM | REGOLAMENTO | ::. | NEI PREFERITI | .:: | RSS Forum | RSS News | NEWS web | NEWS software | |
| PUBBLICITA' | | | ARTICOLI | WIN XP | VISTA | WIN 7 | REGISTRI | SOFTWARE | MANUALI | RECENSIONI | LINUX | HUMOR | HARDWARE | DOWNLOAD | | | CERCA nel FORUM » | |
20-01-2015, 13.05.13 | #1 |
Newbie
Registrato: 13-01-2015
Messaggi: 2
|
vba excel argomento Target
in base al codice che posterò, vorrei evitare di ripetere per 3 celle la stessa operazione. Praticamente dovrei evidenziare le 4 celle e agire sul font. Come potrei fare? Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo errore If Intersect([a4:a250], Target) Is Nothing Then Exit Sub If Target.Value > 0 Then Target.Offset(0, 1).Font.ColorIndex = xlAutomatic Target.Offset(0, 2).Font.ColorIndex = xlAutomatic Target.Offset(0, 3).Font.ColorIndex = xlAutomatic Target.Offset(0, 4).Font.ColorIndex = xlAutomatic Else errore: Target.Offset(0, 1).Font.ColorIndex = 16 Target.Offset(0, 2).Font.ColorIndex = 16 Target.Offset(0, 3).Font.ColorIndex = 16 Target.Offset(0, 4).Font.ColorIndex = 16 End If End Sub ovviamente ho provato con: Target.Offset(Target.Cells, Target.Offset(0, 4)).Font.ColorIndex = 16 Target.Offset(Target.Cells, Target.Offset(0, 4)).Font.ColorIndex = xlAutomatic ma non va . utilizzo excel 2013 Grazie per l'aiuto Raf |
21-01-2015, 19.14.54 | #2 |
Senior Member
WT Expert
Registrato: 19-05-2007
Loc.: Verona
Messaggi: 1.302
|
Rif: vba excel argomento Target
prova così.
Codice:
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Range("A1:A10"), Target) Is Nothing Then Exit Sub If Target.Value > 0 Then Range(Cells(Target.Row, 2), Cells(Target.Row, 5)).Font.ColorIndex = xlAutomatic Else Range(Cells(Target.Row, 2), Cells(Target.Row, 5)).Font.ColorIndex = 16 End If End Sub
___________________________________
- Il primo fondamento della sicurezza non e' la tecnologia, ma l'attitudine mentale - |
Tags |
excel, target, vba |
Utenti attualmente attivi che stanno leggendo questa discussione: 1 (0 utenti e 1 ospiti) | |
Strumenti discussione | |
|
|
Discussioni simili | ||||
Discussione | Autore discussione | Forum | Risposte | Ultimo messaggio |
Corso VBA | Alexsandra | Guide | 85 | 16-11-2016 11.11.51 |
Free Word password / Excel password recovery | crazy.cat | Segnalazioni Web | 4 | 03-03-2012 15.27.53 |
[Guida] Crea e invia file PDF da Excel con VBA | Alexsandra | Guide | 0 | 18-02-2012 15.47.31 |
Microsoft Office Compatibility Pack per formati di file Word, Excel e PowerPoint 2007 | crazy.cat | Segnalazioni Web | 0 | 19-01-2007 16.09.52 |