Assalamu'alaikum.
Pa haris berhubung tidak ada file yang di lampirkan, saya tentukan sendiri
kalau nomor urut pada kolom A.
Private Sub CommandButton1_Click()
Dim CariProduk As String
CariProduk = Me.NoKP.Value
If Trim(CariProduk) <> "" Then
With Sheets("ItemCOQ").Range("A2:A1048576")
Set C = .Find(CariProduk, LookIn:=xlValues)
If Not C Is Nothing Then
Application.Goto C, True
If C = "" Then
Sheets("ItemCOQ").Range("A1").Select
End If
baris = C.Row
Me.ProdukKP.Value = Worksheets("ItemCOQ").Cells(baris, 2).Value
TestCheckBox (ActiveCell.Row)
Else
MsgBox " Nomor urut tidak ada", vbCritical
End If
End With
Else
Me.ProdukKP.Value = "Produk Tidak Ada"
End If
End Sub
‘ fungsi untuk pengecekan cell dengan nama checkbox
Public Function ValChb(Rng As Range, cbox As String) As Boolean
If Rng.Value = cbox Then
ValChb = True
Else
ValChb = False
End If
End Function
Sub TestCheckBox(IdxRow As Integer)
With Sheets("ItemCOQ")
CheckBox1.Value = ValChb(.Cells(IdxRow, 2), CheckBox1.Caption)
CheckBox2.Value = ValChb(.Cells(IdxRow, 3), CheckBox2.Caption)
CheckBox3.Value = ValChb(.Cells(IdxRow, 4), CheckBox3.Caption)
CheckBox4.Value = ValChb(.Cells(IdxRow, 5), CheckBox4.Caption)
CheckBox5.Value = ValChb(.Cells(IdxRow, 6), CheckBox5.Caption)
CheckBox6.Value = ValChb(.Cells(IdxRow, 6), CheckBox6.Caption)
End With
End Sub
Wasalam
Suyono
From: [email protected] [mailto:[email protected]]
Sent: Thursday, October 16, 2014 1:34 PM
To: [email protected]
Subject: [belajar-excel] Mencari data Untuk CheckBox [1 Attachment]
Assalamu'alaikum.
Salam sukses untuk para master semua.
Kali ini, saya mau bertanya terkait mencari data, kemudian data tersebut muncul
pada CheckBox yang kita buat. Saya telah membuat pendarian data, yang
ditampilkan pada TextBox dengan macro spt dibawah
Dim CariProduk As String
CariProduk = Me.NoKP.Value
If Trim(CariProduk) <> "" Then
With Sheets("ItemCOQ").Range("A2:A1048576")
Set C = .Find(CariProduk, LookIn:=xlValues)
If Not C Is Nothing Then
Application.Goto C, True
If C = "" Then
Sheets("ItemCOQ").Range("A1").Select
End If
baris = C.Row
Me.ProdukKP.Value = Worksheets("ItemCOQ").Cells(baris, 2).Value
Else
Me.ProdukKP.Value = "Produk Tidak Ada"
Kemudian saya ingin memunculkan data pengetesan yang ditampilkan pada CheckBox
sebagaimana gambar terlampir. Misal No urut 002
Item Test
CheckBox Appearance tercentang
CheckBox Colour ASTM tercentang
CheckBox Density tercentang
CheckBox Total Base Number tidak tercentang
CheckBox Viscosity Kinematic 40 tidak tercentang
CheckBox Viscosity Kinematic 100 tercentang
Mohon pencerahan pada para master excel semua. Terima kasih
Salam Haris