0978045671
Thành viên mới
- Tham gia
- 6/2/10
- Bài viết
- 0
- Được thích
- 0
Mình có 1 hàm này mà chưa hiểu giá trị "AD1" được hiểu theo nghĩa như thế nào ?
Sub TachTCNTVL()
Dim my_arr, sArr, dArr(1 To 100, 1 To 1), d As Object, v As Variant, Ma As String, Ws As Worksheet
Dim J As Long, I As Long, K As Long
Set Ws = ActiveSheet
On Error Resume Next
Set d = CreateObject("Scripting.Dictionary")
Ma = Ws.Range("AD1")
With Sheets("TCNT")
sArr = .Range("A3", .Range("A65000").End(3)).Resize(, 2).Value
End With
my_arr = Split(Ma, ";")
For I = LBound(my_arr) To UBound(my_arr)
d(Application.WorksheetFunction.Substitute(my_arr(I), " ", "")) = 1
Next I
For Each v In d.keys()
For I = 1 To UBound(sArr)
If Application.WorksheetFunction.Substitute(sArr(I, 1), " ", "") = v Then
K = K + 1
dArr(K, 1) = " - " & sArr(I, 1) & ": " & sArr(I, 2)
Exit For
End If
Next I
Next v
With Ws
.Range("E88:M97").ClearContents
.Range("E88:M97").EntireRow.Hidden = False
If K Then
.Range("E88").Resize(K, 1) = dArr
End If
.Range("E88:M97").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
End With
End Sub
Mong được giải đáp ạ.
Cảm ơn mọi người rất nhiều !!!!
Sub TachTCNTVL()
Dim my_arr, sArr, dArr(1 To 100, 1 To 1), d As Object, v As Variant, Ma As String, Ws As Worksheet
Dim J As Long, I As Long, K As Long
Set Ws = ActiveSheet
On Error Resume Next
Set d = CreateObject("Scripting.Dictionary")
Ma = Ws.Range("AD1")
With Sheets("TCNT")
sArr = .Range("A3", .Range("A65000").End(3)).Resize(, 2).Value
End With
my_arr = Split(Ma, ";")
For I = LBound(my_arr) To UBound(my_arr)
d(Application.WorksheetFunction.Substitute(my_arr(I), " ", "")) = 1
Next I
For Each v In d.keys()
For I = 1 To UBound(sArr)
If Application.WorksheetFunction.Substitute(sArr(I, 1), " ", "") = v Then
K = K + 1
dArr(K, 1) = " - " & sArr(I, 1) & ": " & sArr(I, 2)
Exit For
End If
Next I
Next v
With Ws
.Range("E88:M97").ClearContents
.Range("E88:M97").EntireRow.Hidden = False
If K Then
.Range("E88").Resize(K, 1) = dArr
End If
.Range("E88:M97").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
End With
End Sub
Mong được giải đáp ạ.
Cảm ơn mọi người rất nhiều !!!!