kalo menurut Jan.. lebih mudah dengan cara manual..
tinggal blok area yang ingin diberi border, lalu pilih jenis bordernya..
selesai.. simpel dan tidak berbelit-belit

tapi.. kalo mau pakai vba.. coba lihat script di bawah ini:
jumlah baris diinput pada cel c1, jumlah kolom diinput pada cel c2, lalu
panggil vbanya..

maaf.. tidak melampirkan filenya..

Sub BorderOtomatis()
    Dim lRow As Long, iCol As Integer
    Dim rgClear As Range, rgTabel As Range

    lRow = Range("c1").Value
    iCol = Range("c2").Value

    If lRow < 1 Then
        MsgBox "Jumlah baris minimal harus 1", vbOKOnly
        Exit Sub
    End If
    If iCol < 1 Then
        MsgBox "Jumlah kolom minimal harus 1", vbOKOnly
        Exit Sub
    End If

    Application.ScreenUpdating = False
    Set rgClear = Range(Range("a5"), Range("a5").End(xlDown).End(xlToRight))
    With rgClear
        .Borders(xlDiagonalDown).LineStyle = xlNone
        .Borders(xlDiagonalUp).LineStyle = xlNone
        .Borders(xlEdgeLeft).LineStyle = xlNone
        .Borders(xlEdgeTop).LineStyle = xlNone
        .Borders(xlEdgeBottom).LineStyle = xlNone
        .Borders(xlEdgeRight).LineStyle = xlNone
        .Borders(xlInsideVertical).LineStyle = xlNone
        .Borders(xlInsideHorizontal).LineStyle = xlNone
    End With

    Set rgTabel = Range(Cells(5, 1), Cells(lRow + 4, iCol))
    With rgTabel.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With rgTabel.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With rgTabel.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With rgTabel.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With rgTabel.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With rgTabel.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    Application.ScreenUpdating = True
End Sub

 Salam,

-Miss Jan Raisin-


Pada 25 September 2013 10.45, M.Ade Alfarid <[email protected]> menulis:

> **
> Bisa kirim contohnya dan penjelasannya mas nandha?
> Sketsa atau pola sederhana lebih dari cukup untuk melihat permasalahnnya.
> Tidak usah script dulu,buatin aja gambar2nya inginnya seperti apa.
> Jangan dibikin bingung mas, mudah2an BeExceler bisa membantu kesulitannya.
>
> Salam,
> Ade
>
> On Wed, 25 Sep 2013 07:16:01 +0700, <[email protected]> wrote:
>
> > hali rekan-rekan,
> >
> > saya ingin membuat tabel dengan vba for excel, jadi saya ingin membuat
> > userform
> > isinya jumlah baris dan kolom, kemudian otomatis dibuat tabel sesuai
> > jumlah
> > baris dan kolom input,
> >
> > dalam artiannya begini, jika kita input jumlah baris 4 dan kolom 2, maka
> > otomatis ada tabel sudah di border dengan 4 baris dan 2 kolom,
> >
> > scriptnya gimana ya?? bingung saya..hehe
> >
> > mohon bantuannya rekan-rekan
> >
> >
> > terima kasih
>

Kirim email ke