Buonasera a tutti,
sono nuovo qui, innanzitutto vi ringrazio per le preziosissime info che divulgate! semplificano di molto la vita lavorativa...
Sto cercando di settare la mia Macro ideale, per ora sto usando quella postata sotto che funziona perfettamente ma che vorrei perfezionare, in particolare:
mi servirebbe che si colorasse la singola cella modificata tra il foglio 1 il 2 e non la riga intera;
come mai se elimino una colonna in uno dei due fogli 1 o 2 nello sviluppo dei fogli 3 e 4 questi si colorano completamente? questo problema non si verifica se elimino una riga...
grazie in advance!
Sub
ConfrontaEColora()
Set Ws1 = Worksheets("Foglio1") 'Elenco Utenti Infrataras
Set Ws2 = Worksheets("Foglio2") 'Elenco Utenti Enel gas
Set Ws3 = Worksheets("Foglio3") 'Utenti che non sono più nel Elenco Utenti Enel gas
Set Ws4 = Worksheets("Foglio4") 'Nuovi Utenti (non erano nel Elenco Utenti Infrataras)
Ws3.Cells.Clear
Ws4.Cells.Clear
Ws1.Cells.Copy Destination:=Ws3.Cells
Ws2.Cells.Copy Destination:=Ws4.Cells
URS = Ws1.Range("A" & Rows.Count).End(xlUp).Row '<<<< alias Foglio3
UCS = Ws1.Range("IV1").End(xlToLeft).Column
Ws3.Select
Ws3.Range(Cells(2, 1), Cells(URS, UCS)).Interior.ColorIndex = 4
URA = Ws2.Range("A" & Rows.Count).End(xlUp).Row '<<< alias Foglio4
Set Ws4 = Ws4
Ws4.Select
UCA = Ws2.Range("IV1").End(xlToLeft).Column
Ws4.Range(Ws4.Cells(2, 1), Ws4.Cells(URA, UCA)).Interior.ColorIndex = 6
For RS = 2 To URS
StrRS = ""
UCA = Ws1.Range("IV" & RS).End(xlToLeft).Column
For CS = 1 To UCA
StrRS = StrRS & Ws1.Cells(RS, CS).Value
Next CS
For RA = 2 To URA
StrRA = ""
For CS = 1 To UCA
StrRA = StrRA & Ws4.Cells(RA, CS).Value
Next CS
If StrRS = StrRA Then
Ws4.Range(Ws4.Cells(RA, 1), Ws4.Cells(RA, 30)).Interior.ColorIndex = 0
End If
Next RA
Next RS
For RA = 2 To URA
StrRA = ""
UCA = Ws2.Range("IV" & RA).End(xlToLeft).Column
For CS = 1 To UCA
StrRA = StrRA & Ws2.Cells(RA, CS).Value
Next CS
For RS = 2 To URS
StrRS = ""
For CS = 1 To UCA
StrRS = StrRS & Ws3.Cells(RS, CS).Value
Next CS
If StrRS = StrRA Then
Ws3.Range(Ws3.Cells(RS, 1), Ws3.Cells(RS, 30)).Interior.ColorIndex = 0
End If
Next RS
Next RA
End Sub