Hello,
I am having some difficulty with a macro I am working on. I know a little bit about VBA but not very much, I mainly know how to record macros in Excel but I did take an entry level VBA course in college a while ago...
Here is what I am trying to accomplish, I want to take two values (from my Results Test worksheet) and input them into a "model" (New Model worksheet) which generates results based on the two inputs. Then take those results and paste them into my Results Test worksheet below the input values I used. I need to do this for numerous columns.
The code below is for just one simulation, I would like to find a way to make this work for a range of columns. The first inputs are in C2 and C3, the next inputs would be D2 and D3, and so on with the generated results below each column of inputs.
Hopefully this makes sense, I am stumped and will be digging out my VBA book from college tonight but I am not to optimistic it will help me out here.
Thanks in advance,
RJ
![]()
Sub Single_Simulation_REV1() ' ' Single_Simulation_REV1 Macro 'Grab input values for model (in rows 2 an 3) from the Results Test worksheet Sheets("New model").Select Range("C5").Select ActiveCell.FormulaR1C1 = "='Results TEST'!R[-3]C" Range("C6").Select ActiveCell.FormulaR1C1 = "='Results TEST'!R[-3]C" Range("C7").Select 'Copy and paste first block of results in Results Test worksheet Range("J178:J203").Select Selection.Copy Sheets("Results TEST").Select Range("C4").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Copy and paste second block of results in Results Test worksheet Sheets("New model").Select Range("J205:J282").Select Application.CutCopyMode = False Selection.Copy Sheets("Results TEST").Select Range("C30").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False End Sub
Bookmarks