How to macro loop to save as a file and go back to the template file to run another variable?

Maxlalala

New Member
Joined
Apr 5, 2013
Messages
1
I am very new to Macro world but find it fascinating. I need to run a essbase retrieve and after it runs, save it as a new file and then come back to the template to run another retrieve. The essbase retrieve needs to run through a list and I am struggling to set loop with variables. For example, C2 is my essbase retrieve and the list is fron C100 to C120. (C2=C100, then C2=C101, etc). Please help me on the loop to make my whole coding workable. As follows is my save and open coding, and it does not really work. :(

Dim WM1 As Workbook
Set wb1 = ActiveWorkbook
Sheets("Store Level Forecast").Select
Range("U2:AT1801").Select
Application.Run macro:="EssMenuRetrieve"
Sheets("DC Pull").Select
Range("B1:AC42").Select
Application.Run macro:="EssMenuRetrieve"
Sheets("Store Level Forecast").Select
THISFILE = Range("C2").Value
ActiveWorkbook.SaveAs Filename:="G:\Control\Shortage Forecast\Shortage Model\2013\2013 Forecast\03-Apr\Hardlines\" & THISFILE
Workbooks.Open Filename:= _
"G:\Control\Shortage Forecast\Shortage Model\2013\2013 Forecast\03-Apr\APR Fcst SHELL.xlsm" _
, UpdateLinks:=0
Range("C3").Select
wb1.Activate
Range("C3").Select
ActiveWindow.Close
Thanks a lot!!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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