Sub Macro1()
Dim i As Long
For i = 1 To 51
Sheets("Main").Cells(i + 13, "D").Copy
With Sheets("Result1")
.Cells(1, 5 * (i - 1) + 1).PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
.Cells(2, 5 * (i - 1) + 1) = "OPT_CHAIN"
.Cells(3, 5 * (i - 1) + 1).FormulaR1C1 = "=BDS(R1C,R2C)"
End With
Next i
End Sub
Sub Macro2()
Dim sourcerange As Range
Dim fillrange As Range
Dim j As Long
With Sheets("Result1") 'correct the sheet name to suit
.Range("B2") = "PX_MID"
.Range("B3").FormulaR1C1 = "=BDP(R[0]C[-1],R2C)"
.Range("B3").Copy .Range("B4:B2002")
.Range("C2") = "VOLUME"
.Range("C3").FormulaR1C1 = "=BDP(R[0]C[-2],R2C)"
.Range("C3").Copy .Range("C3:C2002")
.Range("D2") = "OPT_DELTA"
.Range("D3").FormulaR1C1 = "=BDP(R[0]C[-3],R2C)"
.Range("D3").Copy .Range("D3:D2002")
.Range("E2") = "OPEN_INT"
.Range("E3").FormulaR1C1 = "=BDP(R[0]C[-4],R2C)"
.Range("E3").Copy .Range("E3:E2002")
.Range("B2:E2").Select
.Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
For j = 1 To 49
Cells(2, 5 * j + 2).Select
ActiveSheet.Paste
Next j
End With
End Sub
|