sorry gan,, kali ini saya postng diluar topik judul Blogg ini, namun semoga postingan ini bermanfaat bagi yang membutuhkan.
Private Sub cmdCari_Click()
Dim KodeSiswa
Dim CellTujuan As Range
KodeSiswa = txtKodeSiswa.Text
Set CellTujuan = Range("B:B").Find(What:=KodeSiswa)
If Not CellTujuan Is Nothing Then
txtNamaSiswa.Text = Cells(CellTujuan.Row, 3)
cmbProgramStudi.Text = Cells(CellTujuan.Row, 4)
If Cells(CellTujuan.Row, 5) = "Laki-laki" Then
optLakiLaki.Value = True
ElseIf Cells(CellTujuan.Row, 5) = "Perempuan" Then optPerempuan.Value
= True
End If
txtTempatLahir.Text = Cells(CellTujuan.Row, 6)
Else
MsgBox "Tidak Ada Hasil !"
End If
End Sub
Private Sub cmdTambah_Click()
Dim baris
As Integer
baris =
WorksheetFunction.CountA(Range("B:B"))
baris = baris
+ 1
Cells(baris, 2) = txtKodeSiswa
Cells(baris, 3) = txtNamaSiswa
Cells(baris, 4) = cmbProgramStudi
If optLakiLaki = True Then
Cells(baris, 5) =
"Laki-laki"
ElseIf
optPerempuan = True Then
Cells(baris, 5) = "Perempuan" End If
Cells(baris,
6) = txtTempatLahir
Cells(baris,
7) = txtTanggalLahir
End Sub
Private Sub cmdUbah_Click() Dim
KodeSiswa
Dim CellTujuan
As Range
KodeSiswa =
txtKodeSiswa.Text
Set CellTujuan
= Range("B:B").Find(What:=KodeSiswa)
Cells(CellTujuan.Row, 2) = txtKodeSiswa Cells(CellTujuan.Row, 3)
= txtNamaSiswa Cells(CellTujuan.Row, 4) = cmbProgramStudi If optLakiLaki = True
Then Cells(CellTujuan.Row, 5) = "Laki-laki" ElseIf optPerempuan =
True Then Cells(CellTujuan.Row, 5) = "Perempuan"
End If
Cells(CellTujuan.Row, 6) = txtTempatLahir Cells(CellTujuan.Row,
7) =txtTanggalLahir End Sub
Private Sub
cmdHapus_Click() Dim
KodeSiswa
Dim
CellTujuan As
Range
KodeSiswa =
txtKodeSiswa.Text
Set CellTujuan =Range("B:B").Find(What:=KodeSiswa)
Rows(CellTujuan.Row).Delete Shift:=xlUp
End Sub
Komentar
Posting Komentar