ولك بالمثل اخي
لقد لاحظت ان الاعمدة الاخيرة تتضمن روابط المقاطع على اليوتيوب والفايس اليك تحديث الكود لتتمكن من نسخ Hyperlinks المواقع والانتقال اليها عبر الوورد
Public Property Get n() As Worksheet: Set n = Worksheets("WordCopy")
End Property
Sub Copy_Transfer_WORD1()
Dim arr() As String: Dim cnt() As String
Dim lastRow As Long: Dim rngA As Variant: Dim rngB As Variant
Dim OneRng As Range: Dim tmp As Range: Dim Ary As Variant
Dim i As Long: Dim r As Integer: Dim x As Long: Dim j As Range
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set WS = Worksheets("Sheet1")
n.Visible = xlSheetVisible: n.Cells.UnMerge
n.Range("A1:J" & n.Rows.Count).Clear
lige = 7
lastRow = WS.Range("A" & WS.Rows.Count).End(xlUp).Row
cnt() = Split("I-H,J-I", ",")
rngA = Array(1, 3, 4, 5, 6, 7, 8)
rngB = Array(1, 2, 3, 4, 5, 6, 7)
For i = 0 To UBound(rngA)
With WS
Set OneRng = .Range(.Cells(lige, _
rngA(i)), .Cells(lastRow, rngA(i))).SpecialCells(xlCellTypeVisible)
OneRng.Copy
n.Cells(1, _
rngB(i)).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
End With
Next i
For r = 0 To UBound(cnt): arr = Split(cnt(r), "-")
WS.Range(arr(0) & "8:" & arr(0) & lastRow).Copy Destination:=n.Cells(2, arr(1))
Next r
lr = n.Cells(n.Rows.Count, "A").End(xlUp).Row
Set tmp = n.Range("A1:J" & n.Rows.Count)
Set a = n.Rows(1): Set b = n.Rows(2): Set d = n.[A1:I1]: Set E = n.Range("A3:I" & lr)
a.RowHeight = 75: a.Font.Bold = True: b.RowHeight = 40: b.Font.Bold = True: b.Font.Size = 14: d.Font.Size = 24
d.Merge: d.Interior.Color = RGB(192, 192, 192): n.[A2:I2].Interior.Color = RGB(215, 238, 247)
With E
.Font.Name = "AdvertisingBold": .Font.Size = 13
.WrapText = True: .MergeCells = False
End With
F = n.Cells(2, n.Columns.Count).End(xlToLeft).Column
n.Range(n.Cells(2, 1), n.Cells(lr, F)).Borders.Weight = xlThin
Ary = Array(5, 15, 38, 38, 38, 15, 15, 15, 15)
For x = 0 To UBound(Ary)
n.Columns(x + 1).ColumnWidth = Ary(x)
Next x
Set Irow = n.Range("A3", n.Cells(n.Rows.Count, "A").End(xlUp))
For Each j In Irow.Rows
If j.RowHeight < 20 Then: j.RowHeight = 35: Else j.EntireRow.AutoFit
Next
With tmp
.EntireColumn.HorizontalAlignment = xlCenter
.EntireColumn.VerticalAlignment = xlCenter
End With
With n.Range("A3:A" & n.Cells(Rows.Count, "B").End(xlUp).Row)
.Value = Evaluate("ROW(" & .Address & ")-2")
End With
WS.Activate: ExcelToWordSheet1
n.Visible = xlSheetVeryHidden
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
2024 final V3.xlsm