'Chuong trinh nay hoat dong --> OK
Function M3_Bold(RowDauBeam, RowCuoiBeam)
Dim M3max, M3min1, Beam_All As Range, M3 As Range, Beam_Up As Range
Dim M3min2, Beam_Dn As Range
Dim Row_in_Beam As Long, RowM3max_In_Beam As Long, RowM3max As Long
Dim RowM3min1_In_Beam As Long, RowM3min1 As Long, RowM3min2_In_Beam As Long
Dim RowM3min2 As Long
'Xac dinh vi tri M3max va to dam M3max
Set Beam_All = Range(Cells(RowDauBeam, "F"), Cells(RowCuoiBeam, "F"))
Beam_All.Select 'Minh hoa cho ro nghia (Delete)
M3max = Beam_All(1).Value
Row_in_Beam = 1
For Each M3 In Beam_All
'MsgBox M3.Value 'Minh hoa cho ro nghia (Delete)
If M3.Value >= M3max Then
M3max = M3.Value
RowM3max_In_Beam = Row_in_Beam
End If
Row_in_Beam = Row_in_Beam + 1
Next
RowM3max = RowDauBeam + RowM3max_In_Beam - 1
Cells(RowM3max, "F").Font.Bold = True
Cells(RowM3max, "F").Font.ColorIndex = 7
'Xac dinh vi tri M3min1 va to dam M3min1
Set Beam_Up = Range(Cells(RowDauBeam, "F"), Cells(RowM3max - 1, "F"))
Beam_Up.Select 'Minh hoa cho ro nghia (Delete)
M3min1 = Beam_Up(1).Value
Row_in_Beam = 1
For Each M3 In Beam_Up
'MsgBox M3.Value 'Minh hoa cho ro nghia (Delete)
If M3.Value <= M3min1 Then
M3min1 = M3.Value
RowM3min1_In_Beam = Row_in_Beam
End If
Row_in_Beam = Row_in_Beam + 1
Next
RowM3min1 = RowDauBeam + RowM3min1_In_Beam - 1
Cells(RowM3min1, "F").Font.Bold = True
Cells(RowM3min1, "F").Font.ColorIndex = 7
'Xac dinh vi tri M3min2 va to dam M3min2
Set Beam_Dn = Range(Cells(RowM3max + 1, "F"), Cells(RowCuoiBeam, "F"))
Beam_Dn.Select 'Minh hoa cho ro nghia (Delete)
M3min2 = Beam_Dn(1).Value
Row_in_Beam = 1
For Each M3 In Beam_Dn
'MsgBox M3.Value 'Minh hoa cho ro nghia (Delete)
If M3.Value <= M3min2 Then
M3min2 = M3.Value
RowM3min2_In_Beam = Row_in_Beam
End If
Row_in_Beam = Row_in_Beam + 1
Next
RowM3min2 = RowM3max + RowM3min2_In_Beam
Cells(RowM3min2, "F").Font.Bold = True
Cells(RowM3min2, "F").Font.ColorIndex = 7
M3_Bold = 0
End Function