mokhtar
05-01-2015, 03:27 PM
hi all
l have this code
Option Explicit
Sub export_data()
Dim Path As String
Dim Filename As String
Dim Amro As Workbook
Set Amro = ThisWorkbook
Path = ThisWorkbook.Path & "\OUTPUT\"
Filename = Dir(Path & "*.xls")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename
Amro.Sheets(1).Range("A1:a2").Copy
With ActiveWorkbook.Sheets(1).Range("A1")
.PasteSpecial xlValues
.PasteSpecial xlFormats
Workbooks(Filename).Save
Workbooks(Filename).Close
End With
Filename = Dir()
Loop
Application.DisplayAlerts = True
'Application.ScreenUpdating = True
End Sub
my code for inserting data in Sheet(1) in all closed files in the folder " OUTPUT"
is there a way to update my code for inserting data in all Sheets in all closed files in the folder " OUTPUT"
Thanks in advance for all your help!!
Regards
l have this code
Option Explicit
Sub export_data()
Dim Path As String
Dim Filename As String
Dim Amro As Workbook
Set Amro = ThisWorkbook
Path = ThisWorkbook.Path & "\OUTPUT\"
Filename = Dir(Path & "*.xls")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename
Amro.Sheets(1).Range("A1:a2").Copy
With ActiveWorkbook.Sheets(1).Range("A1")
.PasteSpecial xlValues
.PasteSpecial xlFormats
Workbooks(Filename).Save
Workbooks(Filename).Close
End With
Filename = Dir()
Loop
Application.DisplayAlerts = True
'Application.ScreenUpdating = True
End Sub
my code for inserting data in Sheet(1) in all closed files in the folder " OUTPUT"
is there a way to update my code for inserting data in all Sheets in all closed files in the folder " OUTPUT"
Thanks in advance for all your help!!
Regards