Coba gunakan:
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub
On 02/02/2012 08:51, Rama wrote:
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