Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way
Sub ProcessFiles() Dim i As Long Dim sFolder As String Dim fldr As Object Dim FSO As Object Dim Folder As Object Dim file As Object Dim Files As Object Dim this As Workbook Dim cnt As Long Set FSO = CreateObject("Scripting.FileSystemObject") Set this = ActiveWorkbook sFolder = "C:\MyTest" If sFolder < "" Then Set Folder = FSO.GetFolder(sFolder) Set Files = Folder.Files cnt = 1 For Each file In Files If file.Type = "Microsoft Excel Worksheet" Then Workbooks.Open Filename:=file.Path With ActiveWorkbook With .Worksheets(1) .Range("A16").EntireRow.Insert .Range("A16").Value = "ABC" 'etc. End With .Save .Close End With cnt = cnt + 1 End If Next file End If ' sFolder < "" End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Louise" wrote in message ... How do I apply a macro to all excel sheets in a folder? (in my case I need to insert a row with certain content in row 16 in 700 excel sheets). All sheets are alike. Thank you! Louise |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to create a folder and copy files | New Users to Excel | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) | |||
Macro to copy range from Excel files in folder | Excel Discussion (Misc queries) | |||
Help - applying macro to all files in folder | Excel Programming | |||
Macro to Print All Files in a Folder | Excel Programming |