
Option Explicit
Sub Elabora_Date()
Dim xCell As Range, xRng As Range
Dim Ir As Long
Application.ScreenUpdating = False
Ir = Range("A" & Rows.Count).End(xlUp).Row + 1
Range(Cells(6, 1), Cells(Ir, 4)).ClearContents
Ir = Sheets("dati").Range("AA" & Rows.Count).End(xlUp).Row
Set xRng = Sheets("dati").Range("AA2:A" & Ir)
Ir = 6
For Each xCell In xRng
If xCell <= Cells(2, 4) And xCell >= Cells(2, 2) Then
Cells(Ir, 1) = xCell.Offset(0, -21) 'Descrizione
Cells(Ir, 2) = xCell 'Data
Cells(Ir, 3) = xCell.Offset(0, -8) 'Quota
Cells(Ir, 4) = xCell.Offset(0, 2) 'Valori
Ir = Ir + 1
End If
Next
Range("A5", Range("D" & Rows.Count).End(xlUp).Address).Sort Key1:=[b3], _
Order1:=xlAscending, Header:=xlYes
Application.ScreenUpdating = True
MsgBox "FINITO!"
End Sub |
Option Explicit
Sub Elabora_Date()
Dim xCell As Range, xRng As Range
Dim Ir As Long
Application.ScreenUpdating = False
Ir = Range("A" & Rows.Count).End(xlUp).Row + 1
Range(Cells(6, 1), Cells(Ir, 4)).ClearContents
Ir = Sheets("dati").Range("AA" & Rows.Count).End(xlUp).Row
Set xRng = Sheets("dati").Range("AA2:A" & Ir)
Ir = 6
For Each xCell In xRng
If xCell <= Cells(2, 4) And xCell >= Cells(2, 2) Then
Cells(Ir, 1) = xCell.Offset(0, -21) 'Descrizione
Cells(Ir, 2) = xCell 'Data
Cells(Ir, 3) = xCell.Offset(0, -8) 'Quota
Cells(Ir, 4) = xCell.Offset(0, 2) 'Valori
Ir = Ir + 1
End If
Next
Range("A5", Range("D" & Rows.Count).End(xlUp).Address).Sort Key1:=[b3], _
Order1:=xlAscending, Header:=xlYes
Application.ScreenUpdating = True
MsgBox "FINITO!"
End Sub |
