Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Entrambi devono essere compresi tra minimo e massimo?
Quindi basta che uno dei due non è compreso e non si inserisce la città?
Sub FiltroTemperature()
Const header As String = "A1:F1"
Dim i As Integer, min As Integer, max As Integer
Dim RigaScrittura As Integer
Dim val As Range
Dim citta As String, temp1 As Integer, temp2 As Integer
Dim UltimaRigaCittà As Integer
UltimaRigaCittà = Sheets("Temperature").Range("A1").End(xlDown).Row
Sheets("Temperature").Range("L2:Q" & UltimaRigaCittà).Clear
RigaScrittura = 2
min = Range("I2")
max = Range("J2")
For Each val In Range("A2:A" & UltimaRigaCittà)
citta = val
temp1 = Intersect(val.EntireRow, Range(header).Find("2009").EntireColumn)
temp2 = Intersect(val.EntireRow, Range(header).Find("2013").EntireColumn)
'qui controllo entrambe, se basta una delle due cambia And in mezzo con Or
'If (temp1 >= min And temp1 <= max) Or (temp2 >= min And temp2 <= max) Then
If (temp1 >= min And temp1 <= max) And (temp2 >= min And temp2 <= max) Then
Range("L" & RigaScrittura) = val
Range("M" & RigaScrittura) = temp1
Range("N" & RigaScrittura) = temp2
RigaScrittura = RigaScrittura + 1
End If
Next val
End Sub
Questo è per FiltroTemperature, la stessa cosa si può fare per filtraprecipitazione, ho notato però che c'è nella casella H2 l'anno, devi anche controllare che l'anno sia quello per il min e il max?