Private Sub CommandButton3_Click() ' Luu'
Dim Sh As Worksheet, Cls As Range, Rng As Range
Dim Rws As Long, DaGhi As Boolean '<=|'
Set Sh = Sheets("CSDL"): Rws = Sh.[B65500].End(xlUp).Offset(1).Row
Set Cls = Sh.Range(Sh.[c1], Sh.[c65500].End(xlUp))
If Not Cls.Find([G5].Value, , xlFormulas, xlWhole) Is Nothing Then
MsgBox "Da Nhap Ròi, Ban Oi", , "GPE Xin Luu Ý": Exit Sub
End If
For Each Cls In Range("B10:B58")
If Cls.Value <> "" Then
If DaGhi = False Then '<=|'
7 With Sh.Cells(Rws, "B")
.Value = [C7].Value: DaGhi = True
.Offset(, 3).Value = "G Chu"
.Offset(, 1).Value = [G5].Value
.Offset(, 2).Value = [G7].Value
End With
End If '<=|'
8 With Sh.[G65500].End(xlUp).Offset(1)
.Value = [G5].Value 'Só Hoá Don'
.Offset(, 1).Resize(, 5).Value = Cls.Resize(, 5).Value
End With
End If
Next Cls
With [G7].Interior
If .ColorIndex = 35 Then .ColorIndex = 38 Else .ColorIndex = 35
End With
End Sub