
Sub cerca1()
Dim Lrow As Long, LR As Long, c As Range, Ir As Long, ISRC As String
Application.ScreenUpdating = False
Lrow = Sheets("Conflitti").Range("A" & Rows.Count).End(xlUp).Row
LR = Sheets("Tutti4").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Tutti4").Range("A:A").Interior.ColorIndex = xlNone
For Ir = 2 To Lrow
ISRC = Sheets("Conflitti").Cells(Ir, 4)
With Sheets("Tutti4").Range("E2:E" & LR)
Set c = .Find(ISRC, LookIn:=xlValues)
If Not c Is Nothing Then c.Offset(0, -4).Interior.ColorIndex = 4
End With
Next Ir
Application.ScreenUpdating = True
MsgBox "Terminato"
End Sub |
qui
Application.ScreenUpdating = False
Application.Calculation = xlManual ''sospende il calcolo delle formule
Lrow = Sheets("Conflitti").Range("A" & Rows.Count).End(xlUp).Row
e qui
Next Ir
Application.Calculation = xlAutomatic ''riattiva il calcolo automatico
Calculate '' forza un calcolo = F9 su un foglio di excel
Application.ScreenUpdating = True
|
Option Explicit
Sub ColoraCelleUguali()
'by Marius44
Dim i As Long, j As Long, uriga1 As Long, uriga2 As Long
Dim wks1 As Worksheet, wks2 As Worksheet
Dim Rng As Range
Dim RP, SH, itime, ftime
itime = Timer
Application.ScreenUpdating = False
Set wks1 = ThisWorkbook.Worksheets("Foglio1")
Set wks2 = ThisWorkbook.Worksheets("Foglio2")
Sheets("Foglio1").Select
uriga1 = wks1.Range("A" & Rows.Count).End(xlUp).Row
RP = wks1.Range(Cells(2, 1), Cells(uriga1, 1)).Value ''''
Sheets("Foglio2").Select
Set Rng = Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
Rng.Interior.ColorIndex = xlNone
uriga2 = wks2.Range("A" & Rows.Count).End(xlUp).Row
SH = wks2.Range(wks2.Cells(2, 1), wks2.Cells(uriga2, 1)).Value
For i = 2 - 1 To uriga1 - 1
If RP(i, 1) <> "" Then
For j = 2 - 1 To uriga2 - 1
If RP(i, 1) = SH(j, 1) Then
wks2.Cells(j, 1).Interior.ColorIndex = 4
End If
Next j
End If
Next i
Set wks1 = Nothing
Set wks2 = Nothing
ftime = Timer
Cells(2, 5) = ftime - itime
Application.ScreenUpdating = True
MsgBox "Fatto!", vbExclamation
End Sub
|
Cit: Non riesco a scaricare il file,il copia/incolla ha alterato il link
Io ho solo inserito la punteggiatura in "www dropbox com" per scaricare il file.
Sub ColoraCelleUguali()
'by Marius44
Dim i As Long, j As Long, uriga1 As Long, uriga2 As Long
Dim wks1 As Worksheet, wks2 As Worksheet
Dim Rng As Range
Dim RP, SH, itime, ftime
itime = Timer
Application.ScreenUpdating = False
Set wks1 = ThisWorkbook.Worksheets(1)
Set wks2 = ThisWorkbook.Worksheets(2)
Sheets(1).Select
uriga1 = wks1.Range("A" & Rows.Count).End(xlUp).Row
RP = wks1.Range(Cells(2, 1), Cells(uriga1, 1)).Value ''''
Sheets(2).Select
Range("A:A").Interior.ColorIndex = xlNone
Set Rng = Range("E2:E" & Range("A" & Rows.Count).End(xlUp).Row)
uriga2 = wks2.Range("E" & Rows.Count).End(xlUp).Row
SH = wks2.Range(wks2.Cells(2, 5), wks2.Cells(uriga2, 5)).Value
wks1.Cells(2, 8) = Now
For i = 2 - 1 To uriga1 - 1
If RP(i, 1) <> "" Then
For j = 2 - 1 To uriga2 - 1
If RP(i, 1) = SH(j, 1) Then
wks2.Cells(j, 1).Interior.ColorIndex = 4
End If
Next j
End If
Next i
wks1.Cells(3, 8) = Now
Set wks1 = Nothing
Set wks2 = Nothing
ftime = Timer
Cells(5, 8) = ftime - itime
Application.ScreenUpdating = True
MsgBox "Fatto!", vbExclamation
End Sub
|
Public Sub Colora_Celle()
Dim S1 As Worksheet, S2 As Worksheet
Dim V1 As Variant, V2 As Variant
Dim uR1 As Long, uR2 As Long, R1 As Long, R2 As Long
Dim T1 As Single
'------------------------------------
T1 = Timer
Set S1 = Sheets("Foglio1")
Set S2 = Sheets("Tutti2016_1")
With S1
uR1 = .Cells(Rows.Count, "A").End(xlUp).Row
V1 = .Range("A1:A" & uR1)
End With
With S2
uR2 = .Cells(Rows.Count, "E").End(xlUp).Row
V2 = .Range("E1:E" & uR2)
End With
S2.Range("A:A").Interior.ColorIndex = xlNone
For R1 = 2 To uR1
For R2 = 2 To uR2
If V1(R1, 1) = V2(R2, 1) Then
S2.Cells(R2, 1).Interior.ColorIndex = 4
End If
Next R2
Next R1
MsgBox Format((uR1 - 1) * (uR2 - 1), "standard") & " confronti" & vbCrLf & "in: " & Timer - T1 & " secondi."
Set S1 = Nothing
Set S2 = Nothing
End Sub |
Sub ColoraCelleUguali()
'by Marius44
Dim i As Long, j As Long, uriga1 As Long, uriga2 As Long
Dim wks1 As Worksheet, wks2 As Worksheet
Dim Rng As Range
Dim RP, SH, itime, ftime
itime = Timer
Application.ScreenUpdating = False
Set wks1 = ThisWorkbook.Worksheets("Foglio1")
Set wks2 = ThisWorkbook.Worksheets("Tutti2016_1")
Sheets(1).Select
uriga1 = wks1.Range("A" & Rows.Count).End(xlUp).Row
RP = wks1.Range(Cells(2, 1), Cells(uriga1, 1)).Value ''''
Sheets(2).Select
Range("A:A").Interior.ColorIndex = xlNone
Set Rng = Range("E2:E" & Range("A" & Rows.Count).End(xlUp).Row)
uriga2 = wks2.Range("E" & Rows.Count).End(xlUp).Row
SH = wks2.Range(wks2.Cells(2, 5), wks2.Cells(uriga2, 5)).Value
wks1.Cells(2, 8) = Now
For i = 2 - 1 To uriga1 - 1
If RP(i, 1) <> "" Then
For j = 2 - 1 To uriga2 - 1
If RP(i, 1) = SH(j, 1) Then
wks2.Cells(j, 1).Interior.ColorIndex = 9
End If
Next j
End If
Next i
wks1.Cells(3, 8) = Now
Set wks1 = Nothing
Set wks2 = Nothing
ftime = Timer
Cells(5, 8) = ftime - itime
Application.ScreenUpdating = True
itime = Timer
Application.ScreenUpdating = False
Set wks1 = ThisWorkbook.Worksheets("Foglio1")
Set wks2 = ThisWorkbook.Worksheets("Tutti2016_2")
Sheets(1).Select
uriga1 = wks1.Range("A" & Rows.Count).End(xlUp).Row
RP = wks1.Range(Cells(2, 1), Cells(uriga1, 1)).Value ''''
Sheets(2).Select
Range("A:A").Interior.ColorIndex = xlNone
Set Rng = Range("E2:E" & Range("A" & Rows.Count).End(xlUp).Row)
uriga2 = wks2.Range("E" & Rows.Count).End(xlUp).Row
SH = wks2.Range(wks2.Cells(2, 5), wks2.Cells(uriga2, 5)).Value
wks1.Cells(2, 8) = Now
For i = 2 - 1 To uriga1 - 1
If RP(i, 1) <> "" Then
For j = 2 - 1 To uriga2 - 1
If RP(i, 1) = SH(j, 1) Then
wks2.Cells(j, 1).Interior.ColorIndex = 9
End If
Next j
End If
Next i
wks1.Cells(3, 8) = Now
Set wks1 = Nothing
Set wks2 = Nothing
ftime = Timer
Cells(5, 8) = ftime - itime
Application.ScreenUpdating = True
MsgBox "Fatto!", vbExclamation
End Sub
|
Sub ColoraCelleUguali() ‘versione con ciclo per i Fogli
'by Marius44
Dim i As Long, j As Long, uriga1 As Long, uriga2 As Long
Dim wks1 As Worksheet, wks2 As Worksheet
Dim Rng As Range
Dim RP, SH, itime, ftime
itime = Timer
Application.ScreenUpdating = False
Set wks1 = ThisWorkbook.Worksheets("Foglio1")
wks1.Cells(2, 8) = Now ‘riga spostata
Sheets(1).Select
uriga1 = wks1.Range("A" & Rows.Count).End(xlUp).Row
RP = wks1.Range(Cells(2, 1), Cells(uriga1, 1)).Value ''''
‘inizio ciclo per fogli
For fg = 2 to Sheets.Count
Set wks2 = ThisWorkbook.Worksheets(fg) ‘fg è il numero del Foglio
Sheets(fg).Select
Range("A:A").Interior.ColorIndex = xlNone
Set Rng = Range("E2:E" & Range("A" & Rows.Count).End(xlUp).Row)
uriga2 = wks2.Range("E" & Rows.Count).End(xlUp).Row
SH = wks2.Range(wks2.Cells(2, 5), wks2.Cells(uriga2, 5)).Value
For i = 2 - 1 To uriga1 - 1
If RP(i, 1) <> "" Then
For j = 2 - 1 To uriga2 - 1
If RP(i, 1) = SH(j, 1) Then
wks2.Cells(j, 1).Interior.ColorIndex = 9
End If
Next j
End If
Next i
Next fg
wks1.Cells(3, 8) = Now
Set wks1 = Nothing
Set wks2 = Nothing
ftime = Timer
Cells(5, 8) = ftime - itime
Application.ScreenUpdating = True
MsgBox "Fatto!", vbExclamation
End Sub
|
