comboboxdaki sayfa ismine göre llistviewde sayfalar görüntüleniyor 5 adet textbookda veriler listwieve çift tıklama ile geliyor gelen verilerde düzeltme yapmak istiyorum kodu sizlerden aldığım yardımlarla düzenlemeye çalıştım hata veriyor yardım ederseniz sevinirim
Private Sub CommandButton5_Click()
If ComboBox1.Text = "" Then
MsgBox "LÜTFEN ÖNCE LİSTEDEN BİR SEÇİM YAPIN", vbCritical, "D İ K K A T"
Exit Sub
End If
If ComboBox1.Text = "" Then
MsgBox ("Label1.Text")
TextBox1.SetFocus
Exit Sub
ElseIf TextBox2.Text = "" Then
MsgBox ("Label2.Text"), vbCritical, ("BÖLÜM BOŞ")
TextBox2.SetFocus
Exit Sub
End If
Sheets("Me.ComboBox1.Text").Select
Set S1 = Sheets("Me.ComboBox1.Text")
Dim sat%, sat2 As Long
On Error GoTo hata
cevap = MsgBox("DEĞİŞTİRMEK İSTEDİĞİNİZDEN EMİNMİSİNİZ ?", vbYesNo, "DEĞİŞTİRME ONAYI")
If cevap = vbNo Then
For tem = 1 To 5
Controls("textbox" & tem) = Empty
Next
TextBox1.Enabled = True
TextBox1.SetFocus
Exit Sub
End If
Dim bak As Range
Dim syd As String
Dim Satir As Long
Set S1 = ThisWorkbook.Worksheets(Me.ComboBox1.Text)
sat2 = ListView1.SelectedItem.ListSubItems(7)
If cevap = vbYes Then
SAY = S1.Cells(65536, "B").End(3).Row
For Each bak In S1.Range("B2:B" & SAY)
S1.Range(bak.Offset(0, 0).Address).Value
S1.Range(bak.Offset(0, 1).Address).Value
' MsgBox ad & Syd
If StrConv(ad, vbUpperCase) = StrConv(TextBox1.Text, vbUpperCase) Then
If StrConv(syd, vbUpperCase) = StrConv(TextBox2.Text, vbUpperCase) Then
bak.Select
S1.Range(bak.Offset(0, 0).Address).Value = TextBox1.Text
S1.Range(bak.Offset(0, 1).Address).Value = TextBox2.Text
S1.Range(bak.Offset(0, 2).Address).Value = TextBox3.Text
S1.Range(bak.Offset(0, 3).Address).Value = TextBox4.Text
S1.Range(bak.Offset(0, 4).Address).Value = TextBox5.Text
MsgBox "VERİNİZ DEĞİŞTİRİLDİ", vbInformation, "YENİLEME"
Exit For
' Exit Sub
End If
End If
Next
End If
S1.Range("A2:S65536").Select
Selection.Sort Key1:=S1.Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
SAY = S1.Cells(65536, "A").End(3).Row
ListView1.ListItems.Clear
For i = 2 To SAY
Set liste1 = Me.ListView1.ListItems.Add(, , S1.Cells(i, "A").Value)
liste1.SubItems(1) = S1.Cells(i, "B").Value
liste1.SubItems(2) = S1.Cells(i, "C").Value
liste1.SubItems(3) = S1.Cells(i, "D").Value
liste1.SubItems(4) = S1.Cells(i, "E").Value
liste1.SubItems(5) = S1.Cells(i, "F").Value
'eğer hücre başında (*) işareti var ise satırı mavi renklendir
If Left(S1.Cells(i + 1, 2), 1) = "*" Then
liste1.ListItems(i - 1).ListSubItems(1).ForeColor = vbBlue
liste1.ListItems(i - 1).ForeColor = vbBlue
End If
'eğer hücre başında (-) işareti var ise satırı kırmızı renklendir
If Left(S1.Cells(i + 1, 2), 1) = "-" Then
liste1.ListItems(i - 1).ListSubItems(1).ForeColor = vbRed
liste1.ListItems(i - 1).ForeColor = vbRed
End If
Next i
ListView1.FullRowSelect = True
ListView1.Gridlines = True
MsgBox " ADI = " & TextBox1 & Chr(10) & " SOYADI = " _
& TextBox2, vbInformation, "DEĞİŞTİRME BİLGİLERİ"
sayı = C - 1
Label1 = sayı & " ADET"
For tem = 1 To 5
Controls("textbox" & tem) = Empty
Next
TextBox1.Enabled = True
CommandButton5.Enabled = True
CommandButton5.Enabled = False
TextBox1.SetFocus
TextBox5.Text = ""
hata:
End Sub
Private Sub CommandButton5_Click()
If ComboBox1.Text = "" Then
MsgBox "LÜTFEN ÖNCE LİSTEDEN BİR SEÇİM YAPIN", vbCritical, "D İ K K A T"
Exit Sub
End If
If ComboBox1.Text = "" Then
MsgBox ("Label1.Text")
TextBox1.SetFocus
Exit Sub
ElseIf TextBox2.Text = "" Then
MsgBox ("Label2.Text"), vbCritical, ("BÖLÜM BOŞ")
TextBox2.SetFocus
Exit Sub
End If
Sheets("Me.ComboBox1.Text").Select
Set S1 = Sheets("Me.ComboBox1.Text")
Dim sat%, sat2 As Long
On Error GoTo hata
cevap = MsgBox("DEĞİŞTİRMEK İSTEDİĞİNİZDEN EMİNMİSİNİZ ?", vbYesNo, "DEĞİŞTİRME ONAYI")
If cevap = vbNo Then
For tem = 1 To 5
Controls("textbox" & tem) = Empty
Next
TextBox1.Enabled = True
TextBox1.SetFocus
Exit Sub
End If
Dim bak As Range
Dim syd As String
Dim Satir As Long
Set S1 = ThisWorkbook.Worksheets(Me.ComboBox1.Text)
sat2 = ListView1.SelectedItem.ListSubItems(7)
If cevap = vbYes Then
SAY = S1.Cells(65536, "B").End(3).Row
For Each bak In S1.Range("B2:B" & SAY)
S1.Range(bak.Offset(0, 0).Address).Value
S1.Range(bak.Offset(0, 1).Address).Value
' MsgBox ad & Syd
If StrConv(ad, vbUpperCase) = StrConv(TextBox1.Text, vbUpperCase) Then
If StrConv(syd, vbUpperCase) = StrConv(TextBox2.Text, vbUpperCase) Then
bak.Select
S1.Range(bak.Offset(0, 0).Address).Value = TextBox1.Text
S1.Range(bak.Offset(0, 1).Address).Value = TextBox2.Text
S1.Range(bak.Offset(0, 2).Address).Value = TextBox3.Text
S1.Range(bak.Offset(0, 3).Address).Value = TextBox4.Text
S1.Range(bak.Offset(0, 4).Address).Value = TextBox5.Text
MsgBox "VERİNİZ DEĞİŞTİRİLDİ", vbInformation, "YENİLEME"
Exit For
' Exit Sub
End If
End If
Next
End If
S1.Range("A2:S65536").Select
Selection.Sort Key1:=S1.Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
SAY = S1.Cells(65536, "A").End(3).Row
ListView1.ListItems.Clear
For i = 2 To SAY
Set liste1 = Me.ListView1.ListItems.Add(, , S1.Cells(i, "A").Value)
liste1.SubItems(1) = S1.Cells(i, "B").Value
liste1.SubItems(2) = S1.Cells(i, "C").Value
liste1.SubItems(3) = S1.Cells(i, "D").Value
liste1.SubItems(4) = S1.Cells(i, "E").Value
liste1.SubItems(5) = S1.Cells(i, "F").Value
'eğer hücre başında (*) işareti var ise satırı mavi renklendir
If Left(S1.Cells(i + 1, 2), 1) = "*" Then
liste1.ListItems(i - 1).ListSubItems(1).ForeColor = vbBlue
liste1.ListItems(i - 1).ForeColor = vbBlue
End If
'eğer hücre başında (-) işareti var ise satırı kırmızı renklendir
If Left(S1.Cells(i + 1, 2), 1) = "-" Then
liste1.ListItems(i - 1).ListSubItems(1).ForeColor = vbRed
liste1.ListItems(i - 1).ForeColor = vbRed
End If
Next i
ListView1.FullRowSelect = True
ListView1.Gridlines = True
MsgBox " ADI = " & TextBox1 & Chr(10) & " SOYADI = " _
& TextBox2, vbInformation, "DEĞİŞTİRME BİLGİLERİ"
sayı = C - 1
Label1 = sayı & " ADET"
For tem = 1 To 5
Controls("textbox" & tem) = Empty
Next
TextBox1.Enabled = True
CommandButton5.Enabled = True
CommandButton5.Enabled = False
TextBox1.SetFocus
TextBox5.Text = ""
hata:
End Sub