Pastekan pada kode berikut CommandButton1
Private Sub CommandButton1_Click()
Sheets("DATAGROUP").Range("A5:C17").Value
= ""
For k = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(k) Then
Sheets(ListBox1.List(k)).Select
Sheets(ListBox1.List(k)).Cells.SpecialCells(xlLastCell).Select
Range(Selection, Cells(1, 1)).Select
End If
Next
Set salin
= ActiveSheet.Range("A5:C17")
Set simpan
= Sheets("DATAGROUP").Cells(Cells.Rows.Count, 1).End(xlUp).Offset(1,
0)
salin.Copy
simpan.PasteSpecial
Paste:=xlPasteValues
Application.CutCopyMode
= False
Sheets("DATAGROUP").Range("A3").Value
= ActiveSheet.Range("A3").Value
Sheets("DATAGROUP").Select
End Sub
Pastekan pada kode berikut Pada Userform
Private Sub UserForm_Initialize()
For k = 2 To 7
ListBox1.AddItem Sheets(k).Name
Next
End Sub
Unduh sampel file xlsm >>>> disini
Sekian semoga bermanfaat !
No comments:
Post a Comment