Busaval
Thành viên mới
- Tham gia
- 6/1/20
- Bài viết
- 2
- Được thích
- 0
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, [I4]) Is Nothing Then
Dim Rws As Long, J As Long, Col As Integer, W As Integer
Dim Rng As Range, sRng As Range
Rows("14:16").Hidden = False
With Sheet3
Rws = .[B2].CurrentRegion.Rows.Count
Col = .[B2].CurrentRegion.Columns.Count
ReDim Arr(1 To Col, 1 To 11)
[A14].Resize(Col, 3).Value = Arr()
Set Rng = .[A1].Resize(Rws)
Set sRng = Rng.Find(Target.Value2, , xlFormulas, xlWhole)
If sRng Is Nothing Then
MsgBox "Nothing!", , "GPE.COM Xin Luu Ý!"
Else
Rws = sRng.Row
For J = 1 To Col
If sRng.Offset(, J).Value <> "" Then
W = W + 1: Arr(W, 1) = W
Arr(W, 3) = .Cells(1, J + 1).Value
End If
Next J
End If
End With
If W Then
[A14].Resize(W, 3).Value = Arr()
End If
End If
End Sub
If Not Intersect(Target, [I4]) Is Nothing Then
Dim Rws As Long, J As Long, Col As Integer, W As Integer
Dim Rng As Range, sRng As Range
Rows("14:16").Hidden = False
With Sheet3
Rws = .[B2].CurrentRegion.Rows.Count
Col = .[B2].CurrentRegion.Columns.Count
ReDim Arr(1 To Col, 1 To 11)
[A14].Resize(Col, 3).Value = Arr()
Set Rng = .[A1].Resize(Rws)
Set sRng = Rng.Find(Target.Value2, , xlFormulas, xlWhole)
If sRng Is Nothing Then
MsgBox "Nothing!", , "GPE.COM Xin Luu Ý!"
Else
Rws = sRng.Row
For J = 1 To Col
If sRng.Offset(, J).Value <> "" Then
W = W + 1: Arr(W, 1) = W
Arr(W, 3) = .Cells(1, J + 1).Value
End If
Next J
End If
End With
If W Then
[A14].Resize(W, 3).Value = Arr()
End If
End If
End Sub