> > Buat variabel grup dan prosedur changechk untuk masing-masing grup > checkbox dengan nama variabel dan prosedur yang unique
Kalimat di atas pesannya jelas, yaitu BUAT bukan tambahkan ke yang sudah ada. Anda tinggal menggandakannya dan BUKAN mengubah yang sudah ada. On Thu, Sep 29, 2016 at 9:55 AM, [email protected] [belajar-excel] < [email protected]> wrote: > > > Mohon di koreksi Mr.Kid, kesalahan disebelah mana dan pembetulannya gimana > pada cekrip berikut.?? Maaf belum begitu bias hehehe.. > > > > Private bChange As Boolean, chkGroup1(1 To 5), chkGroup2(6 To 8) As Control > > > > Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean) > > TextBox14.Value = ListBox1.List(ListBox1.ListIndex, 2) > > TextBox15.Value = ListBox1.List(ListBox1.ListIndex, 5) > > End Sub > > > > Private Sub TextBox2_Change() > > If TextBox2.Value = "" Or TextBox12.Value = "" Then > > TextBox13.Value = "" > > Exit Sub > > End If > > TextBox13.Value = Format(CDbl(TextBox12.Value) * CDbl(TextBox12.Value), > "#,##0") > > End Sub > > Private Sub UserForm_Initialize() > > bChange = False > > Set chkGroup1(1) = chk1 > > Set chkGroup1(2) = chk2 > > Set chkGroup1(3) = chk3 > > Set chkGroup1(4) = chk4 > > Set chkGroup1(5) = chk5 > > Set chkGroup2(6) = chk6 > > Set chkGroup2(7) = chk7 > > Set chkGroup2(8) = chk8 > > > > With OpnChk.ListBox1 > > .ColumnCount = 6 > > .ColumnHeads = True > > .ColumnWidths = "30;55;100;70;90" > > .RowSource = "List_dbB1" > > .MultiSelect = fmMultiSelectSingle > > .BoundColumn = 0 > > > > End With > > End Sub > > > > Private Sub chk1_Change() > > ChangeChk 1 > > End Sub > > > > Private Sub chk2_Change() > > ChangeChk 2 > > End Sub > > > > Private Sub chk3_Change() > > ChangeChk 3 > > End Sub > > Private Sub chk4_Change() > > ChangeChk 4 > > End Sub > > > > Private Sub chk5_Change() > > ChangeChk 5 > > End Sub > > Private Sub chk6_Change() > > ChangeChk 6 > > End Sub > > Private Sub chk7_Change() > > ChangeChk 7 > > End Sub > > Private Sub chk8_Change() > > ChangeChk 8 > > End Sub > > > > > > Private Sub ChangeChk(lIdx As Long) > > Dim lChk As Long, bState As Boolean > > > > If bChange Then > > Exit Sub > > End If > > > > If chkGroup1(lIdx).Value Then > > bChange = True > > For lChk = 1 To 5 > > If lChk <> lIdx Then 'selain checkbox yang diubah user > > chkGroup1(lChk).Value = False > > End If > > Next lChk > > bChange = False > > Else 'kalau mau set agar selalu ada yang di-checked, setidaknya > checkbox setelahnya > > If lIdx = 5 Then > > lIdx = 0 > > End If > > chkGroup1(lIdx + 1) = True > > End If > > 'di bawah ini untuk grup 2 > > If chkGroup2(lIdx).Value Then > > bChange = True > > For lChk = 6 To 8 > > If lChk <> lIdx Then 'selain checkbox yang diubah user > > chkGroup2(lChk).Value = False > > End If > > Next lChk > > bChange = False > > Else 'kalau mau set agar selalu ada yang di-checked, setidaknya > checkbox setelahnya > > If lIdx = 3 Then > > lIdx = 0 > > End If > > chkGroup2(lIdx + 1) = True > > End If > > End Sub > > > > Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for > Windows 10 > > > > *From: *'Mr. Kid' [email protected] [belajar-excel] > <[email protected]> > *Sent: *Kamis, 29 September 2016 09.29 > > *To: *BeExcel <[email protected]> > *Subject: *Re: [belajar-excel] menampilkan data di listbox sesuai apa > yangdicheckbox > > > > > > Buat variabel grup dan prosedur changechk untuk masing-masing grup > checkbox dengan nama variabel dan prosedur yang unique > > > > On Thu, Sep 29, 2016 at 9:08 AM, [email protected] [belajar-excel] < > [email protected]> wrote: > > > > Terima kasih Mr.Kid, kalau saya amati dicontoh tersebut untuk chekboxnya > ada satu grup, kalau ada beberap group checkbox cekripnya gimana Mr.Kir..? > saya coba membuat 3 group checkbox > > Berikut cekrip dari Mr.Kid > > > > Private bChange As Boolean, chkGroup(1 To 3) As Control > > > > Private Sub UserForm_Initialize() > > bChange = False > > Set chkGroup(1) = chk1 > > Set chkGroup(2) = chk2 > > Set chkGroup(3) = chk3 > > End Sub > > > > Private Sub chk1_Change() > > ChangeChk 1 > > End Sub > > > > Private Sub chk2_Change() > > ChangeChk 2 > > End Sub > > > > Private Sub chk3_Change() > > ChangeChk 3 > > End Sub > > > > Private Sub ChangeChk(lIdx As Long) > > Dim lChk As Long, bState As Boolean > > > > If bChange Then > > Exit Sub > > End If > > > > If chkGroup(lIdx).Value Then > > bChange = True > > For lChk = 1 To 3 > > If lChk <> lIdx Then 'selain checkbox yang diubah user > > chkGroup(lChk).Value = False > > End If > > Next lChk > > bChange = False > > Else 'kalau mau set agar selalu ada yang di-checked, setidaknya > checkbox setelahnya > > If lIdx = 3 Then > > lIdx = 0 > > End If > > chkGroup(lIdx + 1) = True > > End If > > End Sub > > > > Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for > Windows 10 > > > > *From: *'Mr. Kid' [email protected] [belajar-excel] > <[email protected]> > *Sent: *Sabtu, 24 September 2016 15.49 > *To: *BeExcel <[email protected]> > *Subject: *Re: [belajar-excel] menampilkan data di listbox sesuai apa > yang dicheckbox > > > > > > Coba lihat file yang ada disini > <https://app.box.com/s/a0lf5qh7awv4hl7h4us4yfbtq7st8y6j>. > > Regards, > > Kid > > > > 2016-09-24 9:54 GMT+07:00 [email protected] [belajar-excel] < > [email protected]>: > > > > Selamat siang sedulur dan para master > > Mohon bantuannya bagaimana cara menampildan data di listbox sesuai pilihan > yang ada pada checkbox, serta checkbox dengan cara bergantian dengan kata > lain checkbox hanya bias di check salah satu...file berikut saya lampirkan > dan sudah ada sedikit cekripnya yang saya copas dari beberapa web dan saya > modif sedikit sedikit karena masih belum mudeng dengan macro VBA.. > > > > Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for > Windows 10 > > > > > > > > > > > > >

