Notes
![]() ![]() Notes - notes.io |
Dim srcWb As Workbook
Dim srcSheet As Worksheet
Dim destSheet As Worksheet
Dim copyRange1 As Range, copyRange2 As Range
Dim destRange1 As Range, destRange2 As Range
Dim wbName As String
Dim col As Integer
Dim sheetPassword As String
Dim monthNames As Variant
Dim i As Integer
Dim filePath As String
' أسماء الأشهر
monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
' ورقة العمل النشطة كوجهة
Set destSheet = ActiveSheet
' كلمة مرور حماية الورقة
sheetPassword = "your_password_here"
' تعطيل تحديث الشاشة لتحسين الأداء
Application.ScreenUpdating = False
' تكرار عبر جميع الأشهر
For i = 0 To 11
' تحديد اسم الملف
wbName = Format(i + 1, "00") & "- AS$VMD on-call (" & monthNames(i) & ").xlsx"
' تحديد المسار الكامل للملف (يجب تغييره لمجلد الملفات)
filePath = "C:YourFilePath" & wbName ' <-- استبدل بالمسار الفعلي
' التحقق مما إذا كان الملف موجودًا
If Dir(filePath) <> "" Then
' فتح الملف المصدر
Set srcWb = Workbooks.Open(filePath, ReadOnly:=True)
Set srcSheet = srcWb.Sheets(1) ' تعديل إذا كان اسم الشيت مختلفًا
' إلغاء حماية ورقة الوجهة
On Error Resume Next
destSheet.Unprotect Password:=sheetPassword
On Error GoTo 0
' نسخ النطاق الأول
Set copyRange1 = srcSheet.Range("A5:L49")
Set destRange1 = destSheet.Range("A5")
copyRange1.Copy
destRange1.PasteSpecial Paste:=xlPasteAll
' الحفاظ على عرض الأعمدة
For col = 1 To copyRange1.Columns.Count
destSheet.Columns(copyRange1.Columns(col).Column).ColumnWidth = srcSheet.Columns(copyRange1.Columns(col).Column).ColumnWidth
Next col
' نسخ النطاق الثاني
Set copyRange2 = srcSheet.Range("I1:K4")
Set destRange2 = destSheet.Range("I1")
copyRange2.Copy
destRange2.PasteSpecial Paste:=xlPasteAll
' الحفاظ على عرض الأعمدة
For col = 1 To copyRange2.Columns.Count
destSheet.Columns(copyRange2.Columns(col).Column).ColumnWidth = srcSheet.Columns(copyRange2.Columns(col).Column).ColumnWidth
Next col
' إغلاق الملف المصدر بعد النسخ
srcWb.Close False
End If
Next i
' إعادة تطبيق حماية الورقة
destSheet.Protect Password:=sheetPassword
' تمكين تحديث الشاشة
Application.ScreenUpdating = True
' رسالة نجاح
MsgBox "Data copied from all files successfully!", vbInformation, "Success"
End Sub
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team