Friday, 26 June 2020

MENAMPILKAN DATA PADA LISTBOX SESUAI ISI DI WORKSHEET MACRO VBA

Cara Lain menampilkan data pada ListBox, Berdasarkan list yang di worksheet.
isi dan judulnya.



Sub DATAMB52()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("REPORT")
Dim Last_Row As Long
Last_Row = Application.WorksheetFunction.CountA(sh.Range("A:F"))
With Me.ListBox1
    .ColumnHeads = True
    .ColumnCount = 6
    .ColumnWidths = "80,150,80,50,50,50"
    If Last_Row = 1 Then
        .RowSource = "REPORT!A2:F2"
    Else
        .RowSource = "REPORT!A2:F" & Last_Row
    End If
End With
End Sub


0 comments:

Post a Comment

Silahkan Untuk komentarnya