Hi,
I have a problem with a macro that I would like to create.
I currently copy data in to tab ”Sheet 1” and some of that data, I copy in to a tab “Single Currency”
At the moment I have been recording my key strokes e.g. Single Currency cell E9 = Sheet 1 E2, Single Currency cell F9 = Sheet 1 F2 …and so on( see below script)
Sheets("Sheet1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$K$49").AutoFilter Field:=5, Criteria1:="DKK"
Sheets("Single Currency").Select
Range("E9").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-7]C"
Range("F9").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-7]C"
Range("H9").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-7]C[-7]"
Range("J9").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-7]C[-8]"
Range("L9").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-7]C[-9]"
Range("M9").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-7]C[-9]"
Range("M10").Select
ActiveWindow.SmallScroll ToRight:=3
Range("O9").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-7]C[-5]"
Range("O10").Select
ActiveWindow.SmallScroll ToRight:=5
Range("P9").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-7]C[-7]"
Range("P10").Select
ActiveWindow.SmallScroll ToRight:=-8
Range("E10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("F10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C-R[-1]C-R[-1]C"
Range("H10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("L10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("M10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("O10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("P10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("P11").Select
ActiveWindow.SmallScroll ToRight:=-5
Range("E11").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-8]C"
Range("F11").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-8]C"
Range("H11").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-8]C[-7]"
Range("J11").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-8]C[-8]"
Range("L11").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-8]C[-9]"
Range("M11").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-8]C[-9]"
Range("M12").Select
ActiveWindow.SmallScroll ToRight:=3
Range("O11").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-8]C[-5]"
Range("P11").Select
ActiveCell.FormulaR1C1 = "=Sheet1!R[-8]C[-7]"
Range("P12").Select
ActiveWindow.SmallScroll ToRight:=-2
Range("E12").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("F12").Select
ActiveCell.FormulaR1C1 = "=R[-1]C-R[-1]C-R[-1]C"
Range("H12").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("L12").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("M12").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("O12").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("P12").Select
ActiveCell.FormulaR1C1 = "=R[-1]C"
Range("P13").Select
End Sub
I would really like to loop this so that it fills out the information, instead of me recording the key stokes for each row.
The other problem is that the number of row in the data would vary, so I would need to loop until the last row.
I have had very little experience using “loop” and would really appreciate some help with this
Thanks in advance
Rob
Bookmarks