Macro to Copy to a New File

Rosey08

New Member
Joined
Oct 24, 2008
Messages
27
Hello,

I have no knowledge of VBA, but used the macro recorder to create a macro that copies the output of my model into a new workbook. My problem is that I want to make changes to the model (sensitivity analysis) and then run the macro and have the new data be copied below the previous data set. My macro is copying it over the previous data. Can someone please help me make an adjustment so the macro so it will copy each iteration into the new workbook in an orderly fashion?

Hopefully this is a clear explanation of what I'm trying to do... Thank you!
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Sub TestCopyMacro()
'
' TestCopyMacro Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
Application.Run "RiskRibbonEvent_DeferredCommandClick"
Application.Run "RiskRefreshRibbon"
Range("H2:I2").Select
Selection.Copy
ActiveWindow.ActivateNext
Application.Run "RiskRefreshRibbon"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
 
Upvote 0
One of the things I left out of my first post is that I was having it run a monte carlo simulation using @RISK ...then copying the results to another workbook. Since you are looking into the code that may help understand what is going on.

Thanks again
 
Upvote 0

Forum statistics

Threads
1,224,579
Messages
6,179,656
Members
452,934
Latest member
mm1t1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top