Below is some code that I have writtten which basically import 23 CSV files into one Excel file. What I need to do is to change the month 'August' to a user specified month, either select from a list Jan - Dec or get the user to type the month. When the user has selected say, January, then the code below should change to January instead of August.
Can this be done? and what the code?
Thanks
Code:
Sub Import_CSV()
ChDir _
"C:\Documents and Settings\mebs.sheikh\My Documents\Amex Approvals\August"
Workbooks.Open Filename:= _
"C:\Documents and Settings\mebs.sheikh\My Documents\Amex Approvals\August\Enfield.csv"
Sheets("Enfield").Select
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Workbooks("Cumulative Approval 2010.xls").Worksheets("Sheet1").Activate
Range("A1").Select
ActiveSheet.Paste
Cells.Select
Cells.EntireColumn.AutoFit
Windows("Enfield.csv").Activate
ActiveWindow.Close
If Range("a2") <> "" Then
Range("A2").End(xlDown).Offset(1, 0).Select
Else
Range("A2").End(xlDown).Select
End If
Workbooks.Open Filename:= _
"C:\Documents and Settings\mebs.sheikh\My Documents\Amex Approvals\August\Chertsey.csv"
'Repeat the above process 23 times with difference Office location, Enfield, Chertsey, etc
Thanks
Last edited by a moderator: