if sorunu

Katılım
20 Şubat 2012
Mesajlar
150
Excel Vers. ve Dili
2007 türkçe
Altın Üyelik Bitiş Tarihi
08-08-2020
merhaba herkese iyi çalışmalar
eklemiş olduğum dosyamda comboboxda seçmiş olduğum yıla göre userformdaki karşılıklarını veri çekmek istiyorum.Forumdaki paylaşımlardan öğrendiklerimle

2014 yılını getirebiliyorum ama diğer yılları seçtiğimde getiremiyorum. aşağıdaki formülde nerede de hata yapıyorum acaba?


If TextBox1.Value = ws.Range("b1").Value <> "" Then

TextBox1.Value = ws.Range("b2").Value
ElseIf TextBox1.Value = ws.Range("c1").Value <> "" Then
TextBox1.Value = ws.Range("c2").Value
Else
End If
 

Ekli dosyalar

YUSUF44

Destek Ekibi
Destek Ekibi
Katılım
4 Ocak 2006
Mesajlar
12,084
Excel Vers. ve Dili
İş : Ofis 365 - Türkçe
Ev: Ofis 365 - Türkçe
if satırlarının sonundaki <> "" ifadesi kod dizilimine uygun değil. Eğer aynı zamanda boş olmamasını da istiyorsanız

and ... <> "" then

şeklinde kullanmalısınız. ... yerine boş olmaması gereken hücre bilgisi yazılmalı.
 
Son düzenleme:
Katılım
20 Şubat 2012
Mesajlar
150
Excel Vers. ve Dili
2007 türkçe
Altın Üyelik Bitiş Tarihi
08-08-2020
yusuf44 hocam dediğiniz şekilde yapmaya çalıştım ama istediğimi yapamıyorum.Müsait olduğunuzda dosyaya bakabilirseniz sevinirim.
 

YUSUF44

Destek Ekibi
Destek Ekibi
Katılım
4 Ocak 2006
Mesajlar
12,084
Excel Vers. ve Dili
İş : Ofis 365 - Türkçe
Ev: Ofis 365 - Türkçe
Dosyaya bakarak cevap vermiştim zaten. Hangi hücre boş olmadığında işlem yapılsın istiyorsunuz?
 

YUSUF44

Destek Ekibi
Destek Ekibi
Katılım
4 Ocak 2006
Mesajlar
12,084
Excel Vers. ve Dili
İş : Ofis 365 - Türkçe
Ev: Ofis 365 - Türkçe
Bu arada or değil and kullanılmalı.
 
Katılım
20 Şubat 2012
Mesajlar
150
Excel Vers. ve Dili
2007 türkçe
Altın Üyelik Bitiş Tarihi
08-08-2020
hocam boş olmamasından ziyade b1 hücresinden k1 hücresine kadar seçtiğim yılların karşılığını userforma aktarmak istiyorum
if ile bir kod oluşturmaya çalıştım beceremedim kısacası
 

YUSUF44

Destek Ekibi
Destek Ekibi
Katılım
4 Ocak 2006
Mesajlar
12,084
Excel Vers. ve Dili
İş : Ofis 365 - Türkçe
Ev: Ofis 365 - Türkçe
Anladığım kadarıyla userformdaki Getir düğmesinin kodlarını aşağıdakiyle değiştiriniz:

PHP:
Private Sub CommandButton1_Click()

Dim iRow, Find, bul_satir, degistir_satır As Long

Dim ws As Worksheet
Set ws = Worksheets("resmi tatil")

'copy the data to the database
For i = 2 To ws.Cells(1, Columns.Count).End(xlToLeft).Column
    If ComboBox1.Value * 1 = ws.Cells(1, i).Value Then
    
        TextBox1.Value = ws.Cells(2, i).Value
        TextBox18.Value = ws.Cells(3, i).Value
        TextBox2.Value = ws.Cells(4, i).Value
        TextBox19.Value = ws.Cells(5, i).Value
        TextBox3.Value = ws.Cells(6, i).Value
        TextBox20.Value = ws.Cells(7, i).Value
        TextBox4.Value = ws.Cells(8, i).Value
        TextBox21.Value = ws.Cells(9, i).Value
        TextBox5.Value = ws.Cells(10, i).Value
        TextBox22.Value = ws.Cells(11, i).Value
        TextBox6.Value = ws.Cells(12, i).Value
        TextBox23.Value = ws.Cells(13, i).Value
        TextBox7.Value = ws.Cells(14, i).Value
        TextBox24.Value = ws.Cells(15, i).Value
        TextBox8.Value = ws.Cells(16, i).Value
        TextBox25.Value = ws.Cells(17, i).Value
        TextBox9.Value = ws.Cells(18, i).Value
        TextBox26.Value = ws.Cells(19, i).Value
        TextBox10.Value = ws.Cells(20, i).Value
        TextBox27.Value = ws.Cells(21, i).Value
        TextBox11.Value = ws.Cells(22, i).Value
        TextBox28.Value = ws.Cells(23, i).Value
        TextBox12.Value = ws.Cells(24, i).Value
        TextBox29.Value = ws.Cells(25, i).Value
        TextBox13.Value = ws.Cells(26, i).Value
        TextBox30.Value = ws.Cells(27, i).Value
        TextBox14.Value = ws.Cells(28, i).Value
        TextBox31.Value = ws.Cells(29, i).Value
        TextBox15.Value = ws.Cells(30, i).Value
        TextBox32.Value = ws.Cells(31, i).Value
        TextBox16.Value = ws.Cells(32, i).Value
    End If
Next
End Sub
Bir de userformda yıl seçimi için hem combobox hem de textbox kullanmışsınız, textboxa gerek yok, silin bence.
 
Katılım
20 Şubat 2012
Mesajlar
150
Excel Vers. ve Dili
2007 türkçe
Altın Üyelik Bitiş Tarihi
08-08-2020
çok teşekkür ederim yusuf bey
 
Üst