mungkin menjadi spt ini
If Not ramadhan.EOF Then
.Sheets("reguler").Select
a = 2
Do While Not ramadhan.EOF
.Cells(a, 1) = ramadhan.Fields("cek")
.Cells(a, 2) = ramadhan.Fields("kode_customer")
.Cells(a, 3) = ramadhan("customer_nama")
.Cells(a, 4) = ramadhan("no_invoice")
.Cells(a, 5) = ramadhan("no_faktur")
.Cells(a, 6) = ramadhan("tgl_invoice")
.Cells(a, 7) = ramadhan("tgl_input")
.Cells(a, 8) = ramadhan("kode_item")
.Cells(a, 9) = Val(ramadhan("qty"))
.Cells(a, 10) = Val(ramadhan("harga_beli"))
.Cells(a, 11) = Val(ramadhan("harga_jual"))
.Cells(a, 12) = (ramadhan("qty")) * (ramadhan("harga_beli"))
.Cells(a, 13) = (ramadhan("qty")) * (ramadhan("harga_jual"))
.Cells(a, 14) = (.Cells(a, 13)) - (.Cells(a, 12))
.Cells(a, 15) = ramadhan("remark")
'----tambahan----
With Range(.cell(a, 1), .cell(a, 15))
.Interior.Color = 65535
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With .Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
End With
ramadhan.MoveNext
a = a + 1
Loop
Else
End If
2012/2/2 Rama <rama@gudangmas.com>
>
> Dear Xl mania,
> Saya memiliki program sederhana VB dengan report excel.
> Dari hasil koding di bawah akan menhasilkan data seperti file terlampir (Sheet 1).
> Yang saya mau tanyakan adalah Bagaimana caranya agar saat print, range dari data tersebut memiliki border secara otomatis (Sheet 2).
> Ada yg bisa tambahkan coding dibawah, agar hasilnya bisa seperti yg di inginkan ?
>
> If Not ramadhan.EOF Then
> .Sheets("reguler").Select
> a = 2
> Do While Not ramadhan.EOF
>
> .Cells(a, 1) = ramadhan.Fields("cek")
> .Cells(a, 2) = ramadhan.Fields("kode_customer")
> .Cells(a, 3) = ramadhan("customer_nama")
> .Cells(a, 4) = ramadhan("no_invoice")
> .Cells(a, 5) = ramadhan("no_faktur")
> .Cells(a, 6) = ramadhan("tgl_invoice")
> .Cells(a, 7) = ramadhan("tgl_input")
> .Cells(a, 8) = ramadhan("kode_item")
> .Cells(a, 9) = Val(ramadhan("qty"))
> .Cells(a, 10) = Val(ramadhan("harga_beli"))
> .Cells(a, 11) = Val(ramadhan("harga_jual"))
> .Cells(a, 12) = (ramadhan("qty")) * (ramadhan("harga_beli"))
> .Cells(a, 13) = (ramadhan("qty")) * (ramadhan("harga_jual"))
> .Cells(a, 14) = (.Cells(a, 13)) - (.Cells(a, 12))
> .Cells(a, 15) = ramadhan("remark")
>
> ramadhan.MoveNext
> a = a + 1
> Loop
> Else
> End If
>
> Terima kasih
> Ramadhan
| ayooo... coba cari XL-mania di linkedin.com |
| Gong Xi Fat Choi! Mana angpaonya... wkwkwkwkwk... |
+-------------------------------------------------------------------+
| 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 |
+-------------------------------------------------------------------+
Nenhum comentário:
Postar um comentário