You are on page 1of 7

' inh bien lao dong nam 2008 Sub kt() Dim t Dim kq As String Dim i As Integer: Dim

j As Integer i = 3 t = Cells(i, 4).Value While t <> "" kq = "DB" Select Case t Case Cells(3, 10).Value 'An Lao For j = 3 To 12 If InStr(1, Cells(i, 3).Value, Cells(j, 11).Value, 1) > 0 Then kq = "MN" Next j Case Cells(13, 10).Value 'Vinh thanh For j = 13 To 20 If InStr(1, Cells(i, 3).Value, Cells(j, 11).Value, 1) > 0 Then kq = "MN" Next j Case Cells(22, 10).Value 'Van Canh For j = 22 To 27 If InStr(1, Cells(i, 3).Value, Cells(j, 11).Value, 1) > 0 Then kq = "MN" Next j Case Cells(29, 10).Value 'Tay Son For j = 29 To 33 If InStr(1, Cells(i, 3).Value, Cells(j, 11).Value, 1) > 0 Then kq = "MN" Next j Case Cells(35, 10).Value 'Hoai An For j = 35 To 41 If InStr(1, Cells(i, 3).Value, Cells(j, 11).Value, 1) > 0 Then kq = "MN" Next j Case Cells(43, 10).Value 'Phu Cat For j = 43 To 46 If InStr(1, Cells(i, 3).Value, Cells(j, 11).Value, 1) > 0 Then kq = "MN" Next j Case Cells(48, 10).Value 'Phu My For j = 48 To 49 If InStr(1, Cells(i, 3).Value, Cells(j, 11).Value, 1) > 0 Then kq = "MN" Next j Case Cells(51, 10).Value 'Hoai Nhon For j = 51 To 51 If InStr(1, Cells(i, 3).Value, Cells(j, 11).Value, 1) > 0 Then kq = "MN" Next j Case Cells(53, 10).Value 'Tuy Phuoc

For j = 53 To 53 If InStr(1, Cells(i, 3).Value, Cells(j, 11).Value, 1) > 0 Then kq = "MN" Next j Case Cells(55, 10).Value 'Qui Nhon For j = 55 To 56 If InStr(1, Cells(i, 3).Value, Cells(j, 11).Value, 1) > 0 Then kq = "MN" Next j If InStr(1, Cells(i, 3).Value, Cells(57, 11).Value, 1) > 0 Then kq = "TP" End Select Cells(i, 8).Value = kq i = i + 1 t = Cells(i, 4).Value Wend End Sub ' dinh bien lao dong nam 2008 Sub th() Dim cn As Long Dim cntp As Long Dim cndb As Long Dim cnmn As Long Dim Dim Dim Dim Dim Dim cq As Long cqtp As Long cqdb As Long cqmn As Long tong As Long tn As Long

Dim i As Long Dim t tong = 0 tn = 0 cn = cntp cndb cnmn 0 = 0 = 0 = 0

cq = 0 cqtp = 0 cqdb = 0 cqmn = 0 i = 3 t = Cells(i, 1).Value While t <> "" tong = tong + 1 If Cells(i, 5).Value = "TN" Then tn = tn + 1 If Cells(i, 5).Value = "TN" And Cells(i, 7).Value = "CN" Then cn = cn + 1 If Cells(i, 5).Value = "TN" And Cells(i, 7).Value <> "CN" Then cq = cq + 1

If Cells(i, 5).Value = "TN" And Cells(i, 7).Value = "CN" And Cells(i, 8).Value = "TP" Then cntp = cntp + 1 If Cells(i, 5).Value = "TN" And Cells(i, 7).Value <> "CN" And Cells(i, 8).Value = "TP" Then cqtp = cqtp + 1 If Cells(i, 5).Value = "TN" And Cells(i, 7).Value = "CN" And Cells(i, 8).Value = "DB" Then cndb = cndb + 1 If Cells(i, 5).Value = "TN" And Cells(i, 7).Value <> "CN" And Cells(i, 8).Value = "DB" Then cqdb = cqdb + 1 If Cells(i, 5).Value = "TN" And Cells(i, 7).Value = "CN" And Cells(i, 8).Value = "MN" Then cnmn = cnmn + 1 If Cells(i, 5).Value = "TN" And Cells(i, 7).Value <> "CN" And Cells(i, 8).Value = "MN" Then cqmn = cqmn + 1 i = i + 1 t = Cells(i, 1).Value Wend Cells(2, 14).Value = tong Cells(3, 14).Value = tn Cells(4, Cells(5, Cells(6, Cells(7, 14).Value 14).Value 14).Value 14).Value = = = = cn cntp cndb cnmn

Cells(8, 14).Value = cq Cells(9, 14).Value = cqtp Cells(10, 14).Value = cqdb Cells(11, 14).Value = cqmn End Sub ' Kiem tra khach hanh thuoc vung VTCI Sub ktci() Dim t Dim kq As String Dim i As Integer: Dim j As Integer i = 3 t = Cells(i, 5).Value While t <> "" kq = "" Select Case t Case ActiveWorkbook.Sheets("Dmuc").Cells(3, 1).Value 'An Lao For j = 3 To 8 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(9, 1).Value 'Vinh thanh For j = 9 To 13 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(14, 1).Value 'Van Canh For j = 14 To 16

If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(17, 1).Value 'Tay Son For j = 17 To 18 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(19, 1).Value 'Hoai An kq = "KV2" Case ActiveWorkbook.Sheets("Dmuc").Cells(20, 1).Value 'Phu Cat For j = 20 To 24 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(25, 1).Value 'Phu My For j = 25 To 30 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(31, 1).Value 'Hoai Nhon For j = 31 To 31 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(32, 1).Value 'Tuy Phuoc For j = 32 To 35 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(36, 1).Value 'Qui Nhon For j = 36 To 39 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" Next j End Select Cells(i, 7).Value = kq i = i + 1 t = Cells(i, 5).Value Wend End Sub Sub ktci_themxa() Dim t Dim kq As String Dim xa As String Dim i As Integer: Dim j As Integer xa = "" i = 3

t = Cells(i, 5).Value While t <> "" kq = "" Select Case t Case ActiveWorkbook.Sheets("Dmuc").Cells(3, 1).Value 'An Lao For j = 3 To 8 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" xa = ActiveWorkbook.Sheets("Dmuc").Cells(j, 2).Value End If Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(9, 1).Value 'Vinh thanh For j = 9 To 13 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" xa = ActiveWorkbook.Sheets("Dmuc").Cells(j, 2).Value End If Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(14, 1).Value 'Van Canh For j = 14 To 16 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" xa = ActiveWorkbook.Sheets("Dmuc").Cells(j, 2).Value End If Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(17, 1).Value 'Tay Son For j = 17 To 18 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" xa = ActiveWorkbook.Sheets("Dmuc").Cells(j, 2).Value End If Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(19, 1).Value 'Hoai An kq = "KV2" Case ActiveWorkbook.Sheets("Dmuc").Cells(20, 1).Value 'Phu Cat For j = 20 To 24 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" xa = ActiveWorkbook.Sheets("Dmuc").Cells(j, 2).Value End If Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(25, 1).Value 'Phu My For j = 25 To 30 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" xa = ActiveWorkbook.Sheets("Dmuc").Cells(j, 2).Value End If Next j

Case ActiveWorkbook.Sheets("Dmuc").Cells(31, 1).Value 'Hoai Nhon For j = 31 To 31 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" xa = ActiveWorkbook.Sheets("Dmuc").Cells(j, 2).Value End If Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(32, 1).Value 'Tuy Phuoc For j = 32 To 35 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" xa = ActiveWorkbook.Sheets("Dmuc").Cells(j, 2).Value End If Next j Case ActiveWorkbook.Sheets("Dmuc").Cells(36, 1).Value 'Qui Nhon For j = 36 To 39 If InStr(1, Cells(i, 4).Value, ActiveWorkbook.Sheets("Dmuc").Cells(j , 2).Value, 1) > 0 Then kq = "KV3" xa = ActiveWorkbook.Sheets("Dmuc").Cells(j, 2).Value End If Next j End Select Cells(i, 7).Value = kq Cells(i, 8).Value = xa i = i + 1 t = Cells(i, 5).Value Wend End Sub Sub kt3thanglientiep() Dim i, j, d As Integer Dim thang As String Dim t i = 2 j = 2 d = 0 t = Cells(i, 1).Value thang = "" Do While t <> "" Do While (Cells(i, 1).Value = Cells(i + 1, 1).Value) And (Cells(j + 1, 2).Value = Cells(j, 2).Value + 1) thang = thang & Cells(j, 2).Value & " " i = i + 1 j = j + 1 d = d + 1 Loop If d + 1 >= 3 Then Cells(i, 3).Value = d + 1 Cells(i, 4).Value = thang & Cells(j, 2).Value End If thang = ""

d = 0 i = i + 1 j = j + 1 t = Cells(i, 1).Value Loop End Sub

You might also like