[037] Excel에서 수정 파일 반복(VBA)

3986 단어 Excel
    Sub OpenCloseArray()

        Dim MyFile As String

        Dim Arr(100) As String

        Dim count As Integer

        MyFile = Dir("F:\Desktop\98、99 \" & "*.xls")  ' 

        count = count + 1

        Arr(count) = MyFile

          

        Do While MyFile <> ""

            MyFile = Dir

            If MyFile = "" Then

                Exit Do

            End If

            count = count + 1

            Arr(count) = MyFile         ' 

        Loop

          

        For i = 1 To count

            Workbooks.Open Filename:="F:\Desktop\98、99 \" & Arr(i)  ' Excel 

        

        ' 

        

                Dim allRow As Integer

                allRow = Cells(Rows.count, 1).End(xlUp).Row

                

                For j = 2 To allRow

                    Cells(j, 1) = Cells(j, 1) / 1000

                Next

                

         ' 

            

            ActiveWorkbook.Close savechanges:=True       '

        Next

    End Sub

2010에서 테스트에 문제가 있어서 저장할 수 없지만 2007에서는 가능합니다!
대량 변경이 필요한 내용은 편집 범위 내에 직접 쓰면 됩니다!

좋은 웹페이지 즐겨찾기