اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

الردود الموصى بها

قام بنشر

السلام عليكم ورحمة الله وبركاته

أحبائى فى الله تقبلوا جميعا تحياتى

أقدم لكم اليوم كود لعله يفيد

Copy Each Sheet from Closed Workbooks

Option Explicit
 
Sub  OpenImpShts() 'Excel VBA procedure to Copy each sheet from closed workbook.

    Const sPath="D:\Temp\" 'Change to suit

    Dim sFil As String

    Dim owb As Workbook

    Dim ws As Worksheet

    Dim sh As Worksheet

   

    Set ws=Sheet1

    sFil=Dir(sPath & "*.xl*")

 

    Do While sFil <> "" 'Start the loop through Excel files.

        Set owb=Workbooks.Open(sPath & sFil)

        For Each sh In ActiveWorkbook.Sheets

            sh.[A2:AZ2000]=sh.[A2:AZ2000].Value

            sh.Copy After:=ws

            owb.Close False 'Close no save

       Next sh

        sFil=Dir

    Loop

End Sub

 

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information