Hello
I created a macro which copies certain cells from a row into certain cells in another sheet. Now I would like to apply the macro to the other rows.
The macro:
The cells in which are the values are copied must always be the same. In this case $D$3, $D$4 and $B$7. But with every new row from which the value gets copied, the reference to the row has to move lower too. From H4 to H5, H6 and so on. The same must be true for J4, to J5, J6... and K4 to K5, K6.... I guess I need a loop. But I can't figure out how to do. I have zero experience with VBA.
By the way, I assigned the macro to a shape I created.
I created a macro which copies certain cells from a row into certain cells in another sheet. Now I would like to apply the macro to the other rows.
The macro:
VBA Code:
Sub SubmitSpread()
'
' SubmitSpread Macro
'
'
Range("H4").Select
Selection.COPY
Sheets("SPX").Select
Range("$D$3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("SPX Spreads").Select
Range("J4").Select
Application.CutCopyMode = False
Selection.COPY
Sheets("SPX").Select
Range("$D$4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("SPX Spreads").Select
Range("K4").Select
Application.CutCopyMode = False
Selection.COPY
Sheets("SPX").Select
Range("$B$7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
The cells in which are the values are copied must always be the same. In this case $D$3, $D$4 and $B$7. But with every new row from which the value gets copied, the reference to the row has to move lower too. From H4 to H5, H6 and so on. The same must be true for J4, to J5, J6... and K4 to K5, K6.... I guess I need a loop. But I can't figure out how to do. I have zero experience with VBA.
By the way, I assigned the macro to a shape I created.