Nhờ các anh hiệu chỉnh code sau
Em muốn sau khi copy ra workbook mới thì thực hiện lệnh màu đỏ tại workbok mới.
Em muốn sau khi copy ra workbook mới thì thực hiện lệnh màu đỏ tại workbok mới.
Mã:
Private Sub CommandButton1_Click()
Dim R As Long, M As Long
Sheets(Array("Sheet1")).Copy
[COLOR=#ff0000]With Sheet1[/COLOR]
[COLOR=#ff0000]R = .Range("A5").End(xlDown).Row[/COLOR]
[COLOR=#ff0000]M = .Range("A" & R + 2).End(xlDown).Row[/COLOR]
[COLOR=#ff0000]Range("A" & M + 2, .[A65536].End(xlUp)).Resize(, 4).Copy[/COLOR]
[COLOR=#ff0000]Range("A" & R + 2).Offset(, 5).PasteSpecial xlPasteAll[/COLOR]
[COLOR=#ff0000]Range("A" & M + 2, .[A65536].End(xlUp)).Resize(, 7).EntireRow.Delete[/COLOR]
[COLOR=#ff0000]End With[/COLOR]
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub