Macro Looping help

zaska

Well-known Member
Joined
Oct 24, 2010
Messages
1,046
Hi all..


Code:
  Application.ScreenUpdating = False
    Application.Calculation = xlManual
    ChDir "E:\Macros\Input\NSE Indices"
    Workbooks.Open Filename:="E:\Macros\Input\NSE Indices\BANK NIFTY" & Format(Workbooks("NSE Converter.xls").Sheets("Sheet1").Range("G2").Value, "dd-mm-yyyy") & "-" & Format(Workbooks("NSE Converter.xls").Sheets("Sheet1").Range("G2").Value, "dd-mm-yyyy") & ".csv"
    Columns("A:A").Insert Shift:=xlToRight
    Range("A2").FormulaR1C1 = "BANK NIFTY"
    Rows("1:1").Delete Shift:=xlUp
    Columns("H:H").Delete Shift:=xlToLeft
    Columns("B:B").NumberFormat = "yyyymmdd"
    Range("C1:F1").NumberFormat = "0.00"
    ChDir "E:\Macros\Output"
    ActiveWorkbook.SaveAs Filename:="E:\Macros\Output\BANK NIFTY" & Format(Workbooks("NSE Converter.xls").Sheets("Sheet1").Range("G2").Value, "ddmmyyyy") & ".txt", _
        FileFormat:=xlCSV, CreateBackup:=False
    Application.DisplayAlerts = False
    Application.Calculation = xlAutomatic
    Application.ScreenUpdating = True
    ActiveWindow.Close

Is it possible to loop this code for processing other symbols after BANKNIFTY

The other symbols are

CNX 100
CNX INFRA
CNX IT
CNX MIDCAP
CNX NIFTY JUNIOR
CNX REALTY
NIFTY MIDCAP 50
S&P CNX 500
S&P CNX DEFTY
S&P CNX NIFTY
CNX ENERGY
CNX FMCG
CNX MNC
CNX PHARMA
CNX PSE
CNX PSU BANK
CNX SERVICE
CNX SMALLCAP

I want to put these symbols in Column A and loop the above code and save the output in a single text file..

Kindly suggest any improvement..
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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