Toplu ListBox,Texbox,ComBobox, ChecBox ve OptionButtonların içeriğini temizle

Katılım
30 Kasım 2006
Mesajlar
411
Excel Vers. ve Dili
Excel 2007 - Türkçe
Altın Üyelik Bitiş Tarihi
05.07.2020
Değerli Hocalarım
Aşağıdaki Kod Toplu ListBox,Texbox,ComBobox, ChecBox ve OptionButtonların içeriğini temizlemeye çalıştım ancak uzun zaman takılıp kalıyor Daha kısa nasıl Temizleme yapabilirim.
Private Sub İPTAL_Click()
On Error Resume Next
B6.SetFocus 'OptionButton
B6.Value = False
B7.SetFocus
B7.Value = False
D1.SetFocus
D1.Value = False
D2.SetFocus
D2.Value = False
D3.SetFocus
D3.Value = False
D33.SetFocus
D34.Value = False
D7.SetFocus
D7.Value = False
D8.SetFocus
D8.Value = False
DFİŞİ1.SetFocus
DFİŞİ2.Value = False
F1.SetFocus
F2.Value = False
F3.SetFocus
F4.Value = False
F7.SetFocus
F7.Value = False
F8.SetFocus
F8.Value = False
V1.SetFocus
V1.Value = False
V2.SetFocus
V2.Value = False
V3.SetFocus
V3.Value = False
V4.SetFocus
V4.Value = False
ListBox1.Clear
ListBox2.Clear
ListBox3.Clear
ListBox4.Clear
ListBox5.Clear
ListBox6.Clear
'..................... Özel Buton......................
B5.Caption = ""
F5.Caption = ""
V5.Caption = ""
D23.Caption = ""
'.............................................................
Dim Nesne As Control
For Each Nesne In Controls
Select Case TypeName(Nesne)
Case "TextBox", "ComboBox"
Nesne = ""
End Select
Next
Dim say, i
say = WorksheetFunction.CountA(Range("A2:A65500")) 'Sıralama
For i = 2 To say
Cells(i + 1, 1) = i
Next i
End Sub
 
Katılım
10 Nisan 2008
Mesajlar
394
Excel Vers. ve Dili
EXCEL 2003 TÜRKÇE
for döngüsünü denersen olur

FOR SAY TEXTBOXLARI 4. TEXTBOXTAN 15 E KADAR OLANI SAYIYOR VE İÇLERİNİ TEMİZLİYOR

TEBİ BU OLAY SADECE TEXTLER İÇİN GEÇERLİ BENDE FAZLA UZMAN DEĞİLİM BU KONULARDA

DOSYA EKLERSEN BAKILABİLİR

For v = 4 To 15
Controls("textbox" & v).Value = ""
Next
 
Katılım
30 Kasım 2006
Mesajlar
411
Excel Vers. ve Dili
Excel 2007 - Türkçe
Altın Üyelik Bitiş Tarihi
05.07.2020
Multipagede Toplu ListBox,ChecBox ve OptionButtonların içeriğini temizlemeye çalıştım ancak uzun zaman takılıp kalıyor Daha kısa nasıl Temizleme yapabilirim.

Private Sub İPTAL_Click()
On Error Resume Next
B6.SetFocus 'OptionButton
B6.Value = False
B7.SetFocus
B7.Value = False
D1.SetFocus
D1.Value = False
D2.SetFocus
D2.Value = False
D3.SetFocus
D3.Value = False
D33.SetFocus
D34.Value = False
D7.SetFocus
D7.Value = False
D8.SetFocus
D8.Value = False
DFİŞİ1.SetFocus
DFİŞİ2.Value = False
F1.SetFocus
F2.Value = False
F3.SetFocus
F4.Value = False
F7.SetFocus
F7.Value = False
F8.SetFocus
F8.Value = False
V1.SetFocus
V1.Value = False
V2.SetFocus
V2.Value = False
V3.SetFocus
V3.Value = False
V4.SetFocus
V4.Value = False
ListBox1.Clear
ListBox2.Clear
ListBox3.Clear
ListBox4.Clear
ListBox5.Clear
ListBox6.Clear
'..................... Özel Buton......................
B5.Caption = ""
F5.Caption = ""
V5.Caption = ""
D23.Caption = ""
'................................................. ............
Dim Nesne As Control
For Each Nesne In Controls
Select Case TypeName(Nesne)
Case "TextBox", "ComboBox"
Nesne = ""
End Select
Next

End Sub
 

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,254
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
:cool:
Kod:
Dim nesne As Control
For Each nesne In Me.Controls
    Select Case TypeName(nesne)
        Case "TextBox": nesne = ""
        Case "Combobox": nesne = ""
        Case "OptionButton": nesne = False
        Case "CheckBox": nesne = False
        Case "CommandButton": nesne.Caption = ""
        Case "ListBox": nesne.Clear
    End Select
Next
 

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,254
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
Hemen şunuda belirtmeliyim.
Bu yukarıda yazmış olduğu kodu çalıştırdığınızda Eğer comboboxların changed olaylarına ve/veya textboxların chenged olaylarına ve/veya optionbutonların click olaylarına ve/veya checkboxların click olaylarına yazdığınız kodlar var ise o kodlar çalışacaktır.Bu sebepten bu kodu çalıştırıken dikkat ediniz.Belkide çalışmasının uzun sürmesi bu sebeptendir.Belkide değil kesin bu sbeptendir.:cool:
 
Katılım
30 Kasım 2006
Mesajlar
411
Excel Vers. ve Dili
Excel 2007 - Türkçe
Altın Üyelik Bitiş Tarihi
05.07.2020
Hocam teşekkür ederim.
İkinci uyarınızı inceleyeceğim....
Yaptığım çalışmada seri şekilde işlem tamamlanmaya başladı... Şükranlarımı sunuyorum.. Çorludayız ama görüşemedik... Görüşmek üzere Elinize sağlık....
 
Katılım
8 Eylül 2005
Mesajlar
476
Excel Vers. ve Dili
Excel 2003 - Türkçe
:cool:
Kod:
Dim nesne As Control
For Each nesne In Me.Controls
    Select Case TypeName(nesne)
        Case "TextBox": nesne = ""
        Case "Combobox": nesne = ""
        Case "OptionButton": nesne = False
        Case "CheckBox": nesne = False
        Case "CommandButton": nesne.Caption = ""
        Case "ListBox": nesne.Clear
    End Select
Next
Hocam, "Image" nesnesine hangi kod uygulanmalı?

Saygılarımla...
 
Katılım
8 Eylül 2005
Mesajlar
476
Excel Vers. ve Dili
Excel 2003 - Türkçe
Sayın hocam,

Problem çözülmüştür.

Teşekkürler...
 
Üst