• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Option Butonla seçilen sayfada kritere göre arama

Katılım
1 Ağustos 2005
Mesajlar
41
Private Sub CommandButton1_Click()
If OptionButton1.Value = True Then
Set S1 = Sheets("İşçi")
ElseIf OptionButton2.Value = True Then
Set S1 = Sheets("Memur")
ElseIf OptionButton3.Value = True Then
Set S1 = Sheets("Şirket İşçisi")
Else
MsgBox "Lütfen Kadro Seçiniz.", vbExclamation, "DİKKAT !"
Exit Sub
End If

Arkadaşlar Merhaba yukarıdaki kodlarla Optionbutton ile seçtiğim sayfaya gidip b sütünunda sitede bulduğum aşağıdaki kodlarla textbox a girdiğim kritere göre arama yapıp sorgu sayfasına aktarmak istiyorum.

Sheets("sorgu").Select
Set S1 = Sheets("Ali")
[a4: p65536].ClearContents
For a = 5 To S1.[p65536].End(3).Row
If Left(S1.Cells(a, "b"), Len(TextBox1)) = TextBox1 Then
c = c + 1
Cells(c + 1, "a") = S1.Cells(a, "a")
Cells(c + 1, "b") = S1.Cells(a, "b")
Cells(c + 1, "c") = S1.Cells(a, "c")
Cells(c + 1, "d") = S1.Cells(a, "e")
Cells(c + 1, "e") = S1.Cells(a, "m")
Cells(c + 1, "f") = S1.Cells(a, "n")
Cells(c + 1, "g") = S1.Cells(a, "o")
Cells(c + 1, "h") = S1.Cells(a, "p")
End If

Ancak Optionbuttonla seçtiğim sayfada arama yaptıramadım yardımcı olursanız sevinirim. Nerede hata yapıyorum çözemedim.
Set S1 = Sheets("Ali") sanırım burada sayfa ismini optionbuttona göre ayarlamam lazım ama beceremedim. Lütfen yardım edin
 
Arkadaşlar sorun çözüldü teşekkür ederi. kodları aşağıdaki gibi değiştirince sorunu halledebildim.
Private Sub CommandButton1_Click()
If OptionButton1.Value = True Then
Set S1 = Sheets("İşçi")
ElseIf OptionButton2.Value = True Then
Set S1 = Sheets("Memur")
ElseIf OptionButton3.Value = True Then
Set S1 = Sheets("Şirket İşçisi")
Else
MsgBox "Lütfen Kadro Seçiniz.", vbExclamation, "DİKKAT !"
Exit Sub
End If
Sheets("sorgu").Select
Set S2 = s1
[a4: p65536].ClearContents
For a = 5 To S1.[p65536].End(3).Row
If Left(S1.Cells(a, "b"), Len(TextBox1)) = TextBox1 Then
c = c + 1
Cells(c + 1, "a") = S2.Cells(a, "a")
Cells(c + 1, "b") = S2.Cells(a, "b")
Cells(c + 1, "c") = S2.Cells(a, "c")
Cells(c + 1, "d") = S2.Cells(a, "e")
Cells(c + 1, "e") = S2.Cells(a, "m")
Cells(c + 1, "f") = S2.Cells(a, "n")
Cells(c + 1, "g") = S2.Cells(a, "o")
Cells(c + 1, "h") = S2.Cells(a, "p")
End If
 
Geri
Üst