Ana içeriğe atla

04.10.2011 4.ÖRNEK


Sub hesapla()
For k = 1 To 10
Cells(k, 2) = Cells(k, 1) * 0.18
'A Sütunundaki verilerin %18 Aldı
If Cells(k, 2) > 300 Then
'300 den büyükse
Cells(k, 2).Select
Selection.Interior.Color = vbYellow
'O alanı seçip arkaplan rengini değiştirecek
' rgb,18880,vbrenk olabilir.
End If
Next k
End Sub

Yorumlar

Bu blogdaki popüler yayınlar

04.10.2011 2.ÖRNEK(Veri Tabanı)

04.10.2011 2.ÖRNEK Sub hesapla() For x = 1 To 10 ' burada D sütunun içine A sütunun ilk harfi ve nokta sonra B sütunun birleşmiş halidir. Cells(x, 4) = Left(Cells(x, 1), 1) & "." & " " & Cells(x, 2) ' burada E sütunun içine A sütunuyla B sütunun birleştirmiştir. Cells(x, 5) = Cells(x, 1) & "  " & Cells(x, 2) Next x End Sub

Uygulama Sınavı S-1

İsmi A ile Başlayan Kişi Sayısı Option Compare Database Sub soru1() Dim db As Database Dim rst As Recordset Set db = CurrentDb Set rst = db.OpenRecordset("Tablo1") toplam = 0 Do Until rst.EOF If Left(rst.Fields("ad").Value, 1) = "a" Then toplam = toplam + 1 End If rst.MoveNext Loop MsgBox (toplam) End Sub

bir tablodan diğer bir tabloya veri aktarımı

Option Compare Database Dim db As Database Dim rst As Recordset Dim rs As Recordset2 Sub kayıt() Set db = CurrentDb() Set rst = db.OpenRecordset("tablo1") Set rs = db.OpenRecordset("yedek") Do Until rst.EOF rs.AddNew rs.Fields("isim").Value = rst.Fields("isim").Value rs.Update rst.MoveNext Loop End Sub