Sub DeleteRowsFromFirstSheetInFolder()
Dim folderPath As String
Dim fileName As String
Dim wb As Workbook
Dim ws As Worksheet
Dim i As Integer
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
folderPath = "F:\两项补贴\1"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(folderPath)
For Each objFile In objFolder.Files
If LCase(Right(objFile.Name, 4)) = ".xls" Or LCase(Right(objFile.Name, 5)) = ".xlsx" Then
Set wb = Workbooks.Open(objFile.Path)
Set ws = wb.Sheets(1)
For i = 1 To 3
ws.Rows(1).Delete
Next i
wb.Close SaveChanges:=True
End If
Next objFile
Set objFolder = Nothing
Set objFile = Nothing
Set objFSO = Nothing
End Sub