Mungkin begini...:
Sub UnstructuredTextToTabel()
' by hapsari & siti Vi
' smg, 1 Oktober 2011
'---------------------
Dim Rng As Range, Tbl As Range, ArStr, Strx As String
Dim N As Long, r As Long, p As Integer
On Error GoTo Ngisor
Set Rng = Application.InputBox( _
"Tentukan Range yg akan diproses", _
"Konversi Unstructured Text to Normal Tabel", _
Selection.Address, , , , , 8)
Set Tbl = Sheets("hasil").Cells(2, 1)
Tbl.Parent.Activate
For N = 1 To Rng.Rows.Count
Strx = WorksheetFunction.Trim(Rng(N, 1))
If Len(Strx) > 0 Then
If Strx Like "ALARM *" Then
ArStr = Split(Strx, " ")
r = r + 1
Tbl(r, 1) = ArStr(1) ' Alarm #
Tbl(r, 2) = ArStr(2) ' type
Tbl(r, 3) = ArStr(3) ' severity
Tbl(r, 4) = ArStr(5) ' ID
Tbl(r, 5) = ArStr(6) ' type alarm
End If
p = InStr(1, Strx, "=")
If p > 0 Then
If LCase(Strx) Like "alarm name*" Then _
Tbl(r, 6) = Mid(Strx, p + 2, 99)
If LCase(Strx) Like "alarm shield*" Then _
Tbl(r, 7) = Mid(Strx, p + 2, 99)
If LCase(Strx) Like "to alarm*" Then _
Tbl(r, 8) = Mid(Strx, p + 2, 99)
If LCase(Strx) Like "modification*" Then _
Tbl(r, 9) = Mid(Strx, p + 2, 99)
End If
End If
Next N
Ngisor:
End Sub
'--------------------
cmiiw
~siti & haps
2011/9/29 dendi wijayatullah <dendi_wijayatullah@yahoo.com>
dear all, mau bertanya sedikit. perkenalkan nama saya dendi.saya mau nanya cara memisahkan data dari tabel pertama menjadi seperti tabel kedua bagaimana ya caranya?
Cara memisahkan data dari begini :
ALARM 1 Fault Critical BSC 2158 Hardware Alarm name = SEND_DIV Channel Critical Alarm Alarm shield flag = Unshielded To alarm box flag = Report Modification flag = Unmodified ALARM 2 Fault Critical BSC 2448 Trunk Alarm name = Optical Receive Channel Alarm Alarm shield flag = Unshielded To alarm box flag = Report Modification flag = Unmodified Jadi begini gan :
Alarm type severity alarm alarm id type alarm alarm name shield alarm report alatm modified alarm 1 Fault Critical 2158 Hardware SEND_DIV Channel Critical Alarm Unshielded Report UnmodifiedGimana yah caranya? Pake macro kah? Terimakasih sebelumnya.
__._,_.___
+-:: XL-mania ::::::::::::::::::::----------------------------------+
| ayooo... coba cari XL-mania di linkedin.com |
| tanggal 3-4 oktober yahoogroup akan mengalami maintenance. |
+-------------------------------------------------------------------+
| DILARANG : MLM, money game, OOT, iklan tanpa izin, SARA, testing, |
| pembicaraan pribadi, one line message, melecehkan, tidak sopan. |
+-------------------------------------------------------------------+
| Buat subjek yang kreatif, jangan : "tanya", "help", "mohon bantu" |
| Usahakan besar attachment < 200 kb. Gunakan winzip jika perlu. |
+-------------------------------------------------------------------+
| Ajak teman-teman Anda bergabung dengan mengirim e-mail kosong ke |
| XL-mania-subscribe@yahoogroups.com atau kirimkan mereka file dari |
| http://groups.yahoo.com/group/XL-mania/files/Promotion/ |
+-------------------------------------------------------------------+
| Berikan testimoni di : http://www.friendster.com/xlmania atau... |
| http://www.xl-mania.com/2008/06/testimoni-xl-mania.html |
+-------------------------------------------------------------------+
| Message lama ada di : |
| http://groups.yahoo.com/group/XL-mania/messages [perlu yahoo id] |
| http://www.mail-archive.com/xl-mania@yahoogroups.com |
+-------------------------------------------------------------------+
| ayooo... coba cari XL-mania di linkedin.com |
| tanggal 3-4 oktober yahoogroup akan mengalami maintenance. |
+-------------------------------------------------------------------+
| DILARANG : MLM, money game, OOT, iklan tanpa izin, SARA, testing, |
| pembicaraan pribadi, one line message, melecehkan, tidak sopan. |
+-------------------------------------------------------------------+
| Buat subjek yang kreatif, jangan : "tanya", "help", "mohon bantu" |
| Usahakan besar attachment < 200 kb. Gunakan winzip jika perlu. |
+-------------------------------------------------------------------+
| Ajak teman-teman Anda bergabung dengan mengirim e-mail kosong ke |
| XL-mania-subscribe@yahoogroups.com atau kirimkan mereka file dari |
| http://groups.yahoo.com/group/XL-mania/files/Promotion/ |
+-------------------------------------------------------------------+
| Berikan testimoni di : http://www.friendster.com/xlmania atau... |
| http://www.xl-mania.com/2008/06/testimoni-xl-mania.html |
+-------------------------------------------------------------------+
| Message lama ada di : |
| http://groups.yahoo.com/group/XL-mania/messages [perlu yahoo id] |
| http://www.mail-archive.com/xl-mania@yahoogroups.com |
+-------------------------------------------------------------------+
MARKETPLACE
.
__,_._,___
Nenhum comentário:
Postar um comentário