Hi there.
I have this code so far using Macro Recorder but i wanted to change a few parts which i am not too sure how to do:
Its basically supposed to look in specified folder for all files, move them to Main Workbook & rename them slightly
1. Slim
Would like to change this to Environment. I tried *& Environment("USERNAME") &* but this did not work for me.
2.AUDCADm1440.csv
Would like to change this so that code looks for ALL .csv files in this folder instead of 1 specific file
3.Sheets(23)
Would like to change this to look for whatever the last sheet in the main Workbook is (rather than a specific sheet number)
4.Position Risk Calc v9.8.xls"
Would like this to be whatever the main workbook name is from where this macro is fired from. (as i go along - i develop and change the name of the file : guess i am just trying to avoid having to change this code each time if thats possible).
Lastly
I would like the sheet names, for all these *moved* sheets to be renamed by replacing the "m1440" with ""
Phew....
I cant seem to get macro recorder to dish out the results i need when i try to achieve each of the following above
Thanks a big heap in advance....
I have this code so far using Macro Recorder but i wanted to change a few parts which i am not too sure how to do:
Its basically supposed to look in specified folder for all files, move them to Main Workbook & rename them slightly
Sub getcsv()
Workbooks.Open Filename:= _
"C:\Documents and Settings\Slim\Desktop\Positions\Charts\AUDCADm1440.csv"
Sheets("AUDCADm1440").Select
Sheets("AUDCADm1440").Move After:=Workbooks("Position Risk Calc v9.8.xls"). _
Sheets(23)
End Sub
1. Slim
Would like to change this to Environment. I tried *& Environment("USERNAME") &* but this did not work for me.
2.AUDCADm1440.csv
Would like to change this so that code looks for ALL .csv files in this folder instead of 1 specific file
3.Sheets(23)
Would like to change this to look for whatever the last sheet in the main Workbook is (rather than a specific sheet number)
4.Position Risk Calc v9.8.xls"
Would like this to be whatever the main workbook name is from where this macro is fired from. (as i go along - i develop and change the name of the file : guess i am just trying to avoid having to change this code each time if thats possible).
Lastly
I would like the sheet names, for all these *moved* sheets to be renamed by replacing the "m1440" with ""
Phew....
I cant seem to get macro recorder to dish out the results i need when i try to achieve each of the following above
Thanks a big heap in advance....
Last edited: