Form Input Pilih sheets
dengan Combobox Control
Private Sub CommandButton5_Click()
Pilihan pada combobox1
If ComboBox1.Text = "Kelas1" Then
Sheets("data1").Select
ElseIf ComboBox1.Text = "Kelas2" Then
Sheets("data2").Select
ElseIf ComboBox1.Text = "Kelas3" Then
Sheets("data3").Select
End If
‘Menuju ke sheet aktif
ActiveSheet.Range(Selection, Cells(1, 1)).Select
Mengisi baris kosong terakhir
Dim irow As Long
irow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Offset(1, 1).row
ActiveSheet.Cells(irow, 2).Value = TextBox1.Value
ActiveSheet.Cells(irow, 3).Value = TextBox2.Value
ActiveSheet.Cells(irow, 4).Value = TextBox3.Value
ActiveSheet.Cells(irow, 5).Value = TextBox4.Value
ActiveSheet.Cells(irow, 6).Value = TextBox5.Value
End Sub
dengan Combobox Control
Private Sub CommandButton5_Click()
Pilihan pada combobox1
If ComboBox1.Text = "Kelas1" Then
Sheets("data1").Select
ElseIf ComboBox1.Text = "Kelas2" Then
Sheets("data2").Select
ElseIf ComboBox1.Text = "Kelas3" Then
Sheets("data3").Select
End If
‘Menuju ke sheet aktif
ActiveSheet.Range(Selection, Cells(1, 1)).Select
Mengisi baris kosong terakhir
Dim irow As Long
irow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Offset(1, 1).row
ActiveSheet.Cells(irow, 2).Value = TextBox1.Value
ActiveSheet.Cells(irow, 3).Value = TextBox2.Value
ActiveSheet.Cells(irow, 4).Value = TextBox3.Value
ActiveSheet.Cells(irow, 5).Value = TextBox4.Value
ActiveSheet.Cells(irow, 6).Value = TextBox5.Value
End Sub
Download contoh sampelnya file xlsm pada tautan berikut
dibawah ini !
Silahkan dikembangkan dan Semoga bermanfaat !
SAMPEL FILE
No comments:
Post a Comment