Here we are
Option Explicit
Option Base 1
Sub CopyData()
Dim TimeTbl()
Dim DataTbl()
Dim ICol As Long
Dim Limit As Double
Dim F As Range
Dim WkRg As Range
Dim LastRow As Long
Dim Result()
Dim I As Long, II As Long
ICol = 2
With Sheets("report")
.Range("B5", .Range("B5").SpecialCells(xlCellTypeLastCell)).ClearContents
End With
With Sheets("Data")
LastRow = .Range("B" & Rows.Count).End(xlUp).Row
Set WkRg = Range(.Cells(7, "B"), .Cells(LastRow, "B"))
TimeTbl() = WkRg
For Each F In Range(.Range("C2"), .Cells(2, Columns.Count).End(xlToLeft))
If (F.Value <> "") Then
Limit = F.Value
Set WkRg = Range(.Cells(7, F.Column), .Cells(LastRow, F.Column))
DataTbl() = WkRg
ReDim Result(1 To LastRow, 1 To 2)
II = 1
For I = 1 To UBound(TimeTbl, 1)
If ((DataTbl(I, 1) <> "") And (DataTbl(I, 1) >= Limit)) Then
Result(II, 1) = TimeTbl(I, 1): Result(II, 2) = DataTbl(I, 1): II = II + 1
End If
Next I
Sheets("report").Cells(5, ICol).Resize(UBound(TimeTbl, 1), 2) = Result
ICol = ICol + 3
End If
Next F
End With
End Sub
Bookmarks