Mỗi tuần một chuyên đề

Tạo danh sách duy nhất từ 1 vài trường

  • Thread starter SA_DQ
  • Ngày gửi
S

SA_DQ

Thành viên Cố vấn - Webketoan Mentors
29/6/05
569
100
43
66
HCM city
Option Base 1
Dim ij As Integer, iz As Integer

Sub Tao2DS()
' ' Macro recorded 17/07/2006
Dim ij As Integer, iz As Integer
Dim MSL(2, 2) As String
Dim Temp As Variant
Application.ScreenUpdating = False
MSL(1, 1) = "E11:E150": MSL(2, 1) = "F11:F150"
MSL(1, 2) = "L11": MSL(2, 2) = "M11"
For iz = 1 To 2
Temp = "Temp"
Range(MSL(iz, 1)).Select: Selection.Copy
Range("P10").Select: ActiveSheet.Paste
Application.CutCopyMode = False
SapXep
For ij = 10 To 160
If Range("P" & CStr(ij)) = "" Then Exit For
If Temp <> Range("P" & CStr(ij)).Value Then
Temp = Range("P" & CStr(ij)).Value
Else
Range("P" & CStr(ij)).Value = ""
End If
Next ij ' MsgBox Str(ij)
SapXep
Range("P10:p150").Select: Selection.Copy
Range(MSL(iz, 2)).Select: ActiveSheet.Paste
Application.CutCopyMode = False

Next iz
Application.ScreenUpdating = -1
' Range("P11").Select
End Sub
' * * * * * * * * * * * * * *
Sub SapXep()
Range("P10:p149").Select
Selection.Sort Key1:=Range("P10"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal

End Sub
 
Khóa học Quản trị dòng tiền

Xem nhiều

Webketoan Zalo OA