Sub Addr_Split()
Dim Tam
Dim Rg1, Rg2, Cll As Range
Dim Tb1, Tb2, ch As String
Dim k, k1 As Long
On Error GoTo Thoat
k = 0: k1 = 0
Tb1 = "Chon vung du lieu can tach, co the chon ca cot: " & Chr(10) & "(Co the dung chuot quet vung du lieu)"
Tb2 = "SEALAND GPE"
Set Rg1 = Application.InputBox(Tb1, Tb2, , , , , , 8)
If Rg1.Columns.Count > 1 Then MsgBox "Chi chon 1 cot thoi! De nghi chon lai.": Exit Sub
Tb1 = "Chon o dau tien cua cot dich: " & Chr(10) & "(Co the dung chuot de chon)"
Set Rg2 = Application.InputBox(Tb1, Tb2, , , , , , 8)
For Each Cll In Rg1.Cells
If Cll.Text <> "" Then
ch = Replace(Cll.Text, "-", ",")
Tam = Split(ch, ",")
Rg2.Offset(k) = Tam(0)
k1 = k1 + 1
End If
k = k + 1
Next
MsgBox "Da tach tong so " & Format(k1, "#,##0") & " dia chi."
Thoat:
Exit Sub
End Sub