I have made this excel VBA code through a macro recording and would like to know a shorter way of writing it with some sort of input loop maybe?
The sheet has two inputs which vary with respect to time, these are found in cells (B5:Y5) and (B8:Y8). The code picks up the first input (B5) and pastes it into its appropriate cell (J16). It then copies the other input (B8) and pastes it into its appropriate cell (N12). The sheet calculates two outputs and the code copies these from cells (H41) and (K41) into a "RESULTS" table at the bottom.
It repeats this for the next column of cells in the "INPUTS" section and keeps going until the end of the inputs.
I understand this is a very crude way of doing this and would greatly appreciate any help.
Keep in mind I am a complete coding noob :)
Sub CopyVariables()
'
' CopyVariables Macro
'
'
Range("J16").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[-11]C[-8]"
Range("N12").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[-4]C[-12]"
Range("H41").Select
Selection.Copy
Range("E47").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K41").Select
Application.CutCopyMode = False
Selection.Copy
Range("E48").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("J16").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[-11]C[-7]"
Range("N12").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[-4]C[-11]"
Range("H41").Select
Selection.Copy
Range("F47").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("K41").Select
Application.CutCopyMode = False
Selection.Copy
Range("F48").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
....
and keeps repeating for each cell individually.