Şartlı satır numarası

Katılım
26 Eylül 2020
Mesajlar
171
Excel Vers. ve Dili
excel 2019 pro.Türkçe
Altın Üyelik Bitiş Tarihi
26-09-2021
Aşağıdaki kod ile excel sayfasına kayıt yapılıyor.Ancak yeni girişlerde vermesi gereken satır numarasını vermiyor.( 6.satır) Daha farklı bir düzenleme yaparsanız sevinirim.Teşekkürler.

mutlu = Sheets("Anasayfa").Range("A10000").End(3).Row + 1
Sheets("Anasayfa").Cells(mutlu, "A") = TextBox3.Value
If Sheets("Anasayfa").Cells(mutlu, "A") = ComboBox4.Text Then
Sheets("Anasayfa").Cells(mutlu, "B") = Application.WorksheetFunction.VLookup(ComboBox4, Sheets("Anasayfa").Range("A15:N50000"), 2, 0)
Else
Sheets("Anasayfa").Cells(mutlu, "B").FormulaR1C1 = "=Row()"
End If
Sheets("Anasayfa").Cells(mutlu, "C") = TextBox4.Value
Sheets("Anasayfa").Cells(mutlu, "D") = TextBox5.Value
Sheets("Anasayfa").Cells(mutlu, "E") = TextBox6.Value & vbCrLf & vbCrLf
Sheets("Anasayfa").Cells(mutlu, "F") = TextBox7.Value
Sheets("Anasayfa").Cells(mutlu, "G") = TextBox11.Value
Sheets("Anasayfa").Cells(mutlu, "H") = TextBox9.Value
Sheets("Anasayfa").Cells(mutlu, "I") = TextBox10.Value
Sheets("Anasayfa").Cells(mutlu, "J") = ComboBox2.Value
Sheets("Anasayfa").Cells(mutlu, "K") = ComboBox3.Value
MsgBox "KAYIT YAPILMIŞTIR"
 

muygun

Özel Üye
Katılım
6 Temmuz 2004
Mesajlar
9,207
Excel Vers. ve Dili
Excel-2003 Türkçe
Merhaba;

Sheets("Anasayfa").Cells(mutlu, "B").FormulaR1C1 = "=Row()"
satırını;
Sheets("Anasayfa").Cells(mutlu, "B")=mutlu-1
şeklinde düzenleyerek deneyin.
İyi çalışmalar.
 
Katılım
12 Nisan 2012
Mesajlar
533
Excel Vers. ve Dili
Microsoft office professional plus 2019
Altın Üyelik Bitiş Tarihi
18-12-2024
Yardımlarınızla kodu yeniden düzenledim.Çalışan kodu aşağıda paylaşıyorum.

Dim mutlu As Long
mutlu = Sheets("Anasayfa").Cells(Rows.Count, "A").End(3).Row + 1
Sheets("Anasayfa").Cells(mutlu, "A") = TextBox3.Value
Sheets("Anasayfa").Cells(mutlu, "C") = TextBox4.Value
Sheets("Anasayfa").Cells(mutlu, "D") = TextBox5.Value
Sheets("Anasayfa").Cells(mutlu, "E") = TextBox6.Value & vbCrLf & vbCrLf
Sheets("Anasayfa").Cells(mutlu, "F") = TextBox7.Value
Sheets("Anasayfa").Cells(mutlu, "G") = TextBox11.Value
Sheets("Anasayfa").Cells(mutlu, "H") = TextBox9.Value
Sheets("Anasayfa").Cells(mutlu, "I") = TextBox10.Value
Sheets("Anasayfa").Cells(mutlu, "J") = ComboBox2.Value
Sheets("Anasayfa").Cells(mutlu, "K") = ComboBox3.Value
If Sheets("Anasayfa").Cells(mutlu, "A") = ComboBox4.Text Then GoTo atla
Sheets("Anasayfa").Cells(mutlu, "B") = mutlu - 1
Exit Sub
atla:
Sheets("Anasayfa").Cells(mutlu, "B") = mutlu - 1
Sheets("Anasayfa").Cells(mutlu, "B") = Application.WorksheetFunction.VLookup(ComboBox4, Sheets("Anasayfa").Range("A15:N50000"), 2, 0)
MsgBox "KAYIT YAPILMIŞTIR"
 
Üst