- Katılım
- 29 Aralık 2014
- Mesajlar
- 1
- Excel Vers. ve Dili
- office 2007 türkçe
- Altın Üyelik Bitiş Tarihi
- 29.12.2019
Şöyle bir kod derledim
Sub Veriguncelle()
Dim i As Integer
With Sheets("sayfa1")
Call baglanti
For i = 16 To .Range("K65536").End(3).Row
U1 = Cells(i, 1).Value
U2 = Cells(i, 2).Value
U3 = Cells(i, 3).Value
U4 = Cells(i, 4).Value
U5 = Cells(i, 5).Value
U6 = Cells(i, 6).Value
U7 = Cells(i, 7).Value
U8 = Cells(i, 8).Value
U9 = Cells(i, 9).Value
U10 = Cells(i, 10).Value
U11 = Cells(i, 11).Value
sorgu = "select * from tablo where [SIRA]=" & U1 & " AND [YIL]=" & U4 & " AND [EMANETNO]=" & U5 & ""
Set rs = CreateObject("adodb.recordset")
rs.Open sorgu, con, 1, 3
rs.fields(0).Value = U1
rs.fields(1).Value = U2
rs.fields(2).Value = U3
rs.fields(3).Value = U4
rs.fields(4).Value = U5
rs.fields(5).Value = U6
rs.fields(6).Value = U7
rs.fields(7).Value = U8
rs.fields(8).Value = U9
rs.fields(9).Value = U10
rs.fields(10).Value = U11
rs.Update
Next i
Range("a16:K65535").ClearContents
MsgBox "KAYITLAR GÜNCELLENEREK VERİ TABANINA AKTARILDI", vbInformation, "Access güncelleme"
End With
End Sub
Yalnız bir yerde takıldım,
Excel'de hücreler boş olduğu halde güncellemeyi çalıştırdığımda "KAYITLAR GÜNCELLENEREK VERİTABANINA AKTARILDI" mesajı çıkıyor. Güncellenecek veri olmadığında "GÜNCELLENECEK VERİ YOK" mesajı gelmesini istiyorum.
Sub Veriguncelle()
Dim i As Integer
With Sheets("sayfa1")
Call baglanti
For i = 16 To .Range("K65536").End(3).Row
U1 = Cells(i, 1).Value
U2 = Cells(i, 2).Value
U3 = Cells(i, 3).Value
U4 = Cells(i, 4).Value
U5 = Cells(i, 5).Value
U6 = Cells(i, 6).Value
U7 = Cells(i, 7).Value
U8 = Cells(i, 8).Value
U9 = Cells(i, 9).Value
U10 = Cells(i, 10).Value
U11 = Cells(i, 11).Value
sorgu = "select * from tablo where [SIRA]=" & U1 & " AND [YIL]=" & U4 & " AND [EMANETNO]=" & U5 & ""
Set rs = CreateObject("adodb.recordset")
rs.Open sorgu, con, 1, 3
rs.fields(0).Value = U1
rs.fields(1).Value = U2
rs.fields(2).Value = U3
rs.fields(3).Value = U4
rs.fields(4).Value = U5
rs.fields(5).Value = U6
rs.fields(6).Value = U7
rs.fields(7).Value = U8
rs.fields(8).Value = U9
rs.fields(9).Value = U10
rs.fields(10).Value = U11
rs.Update
Next i
Range("a16:K65535").ClearContents
MsgBox "KAYITLAR GÜNCELLENEREK VERİ TABANINA AKTARILDI", vbInformation, "Access güncelleme"
End With
End Sub
Yalnız bir yerde takıldım,
Excel'de hücreler boş olduğu halde güncellemeyi çalıştırdığımda "KAYITLAR GÜNCELLENEREK VERİTABANINA AKTARILDI" mesajı çıkıyor. Güncellenecek veri olmadığında "GÜNCELLENECEK VERİ YOK" mesajı gelmesini istiyorum.