Sub CobaCobi()
Dim ws As Worksheet
Dim wsh As Worksheet
For Each ws In Worksheets
Application.DisplayAlerts = False
If ws.Name <> "Data" Then ws.Delete
Application.DisplayAlerts = True
Next
For i = 5 To 100 'sesuaikan
If Cells(i, 5) <> blank Then
On Error Resume Next
Set wsh = Worksheets(Cells(i, 5).Value)
If wsh Is Nothing Then
Sheets.Add(After:=Worksheets(Worksheets.Count)).Name = Cells(i,
5).Value
With Sheets(Cells(i, 5).Value)
.Range("A4:B4").Value = Split("Tanggal,Inv.", ",")
.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, 2).Value =
Cells(i, 1).Resize(1, 2).Value
End With
Else
With Sheets(Cells(i, 5).Value)
.Range("A4:B4").Value = Split("Tanggal,Inv.", ",")
.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, 2).Value =
Cells(i, 1).Resize(1, 2).Value
End With
End If
On Error GoTo 0
End If
Next
End Sub
>semoga bermanfaat
=======================================
catatan mods
mohon maaf posting ini terlambat karena
masuk ke folder spam
=======================================
________________________________
From: PP 03 <[email protected]>
To: [email protected]
Sent: Fri, July 23, 2010 4:30:02 PM
Subject: [belajar-excel] memecah Data perkota
mohon bantuannya bagaimana code untuk
permasalahan saya ini
file ini semula mempunyai 1 Sheet (Data)
ketika tombol Rekap koto di Klik
1.menDelet semua sheet kecuali sheet Data
2.membuat sheet sesuai nama kota (koom E)
3.memasukkan tanggal (kolom A) dan Inv. (kolom B)
ke Sheet yang telah dibuat
Contoh :disini ada 4 sheet (JKT,SMG,DMK,RMBG)
Thanks & Best Regards
||-----------------------------------------------||
Sidoel