Sheets("Input").Activate
' Init
Set sht = ActiveSheet
' Set Range
Set rng1 = Range([be38], [be38].End(xlDown))
' Apply Formula
''rng1.Offset(0, 2).CurrentArray.Resize(rng1.Rows.Count, 7).FormulaArray = "=MAX((RC5=Process!R2C5:R65536C5)*Process!R2C15:R65536C15)"
Index = 0
For Each c In rng1
With c
If .EntireRow.Hidden Or .EntireColumn.Hidden Then
Else
If c.Address <> rng1(rng1.Count).Address Then
'If is 1st Row
rng1.Offset(0, 2).FormulaR1C1 = "=RC53"
rng1.Offset(0, 3).FormulaR1C1 = "=R[1]C53"
rng1.Offset(0, 4).FormulaR1C1 = "=R[2]C53"
rng1.Offset(0, 5).FormulaR1C1 = "=R[3]C53"
rng1.Offset(0, 6).FormulaR1C1 = "=R[4]C53"
rng1.Offset(0, 7).FormulaR1C1 = "=R[5]C53"
rng1.Offset(0, 8).FormulaR1C1 = "=R[6]C53"
Else
'If IS not 1st Row
rng1.Offset(0, 2).FormulaR1C1 = "=R[" & CStr(0 + Index) & "]53"
rng1.Offset(0, 3).FormulaR1C1 = "=R[" & CStr(1 + Index) & "]C53"
rng1.Offset(0, 4).FormulaR1C1 = "=R[" & CStr(2 + Index) & "]C53"
rng1.Offset(0, 5).FormulaR1C1 = "=R[" & CStr(3 + Index) & "]C53"
rng1.Offset(0, 6).FormulaR1C1 = "=R[" & CStr(4 + Index) & "]C53"
rng1.Offset(0, 7).FormulaR1C1 = "=R[" & CStr(5 + Index) & "]C53"
rng1.Offset(0, 8).FormulaR1C1 = "=R[" & CStr(6 + Index) & "]C53"
End If
Index = Index + 6
End If
End With
Next c
|