- Katılım
- 24 Şubat 2009
- Mesajlar
- 1,077
- Excel Vers. ve Dili
- 2016
Merhaba arkadaşlar; Aşağıdaki kod ile DATA sayfasındaki veriler, CommandButton1_Click() bütonu ile iki tarih arasında verileri alıp, FÖY sayfasına yazıyor. Kod:
Burada mesaj kısmında kırmızı olan yer, FÖY Sayfasına kaç adet veri yazmış ise yani FÖY sayfasının G2 sütunundan başlayarak dolu hücreleri sayıp bana mesaj olarak örneğin "10 adet Föy oluşturulmuştur." şeklinde mesaj almak istiyorum. Heskese teşekkürler.
Kod:
Private Sub CommandButton1_Click()
Dim sh As Worksheet, sonsat As Long, sat As Long, i As Long
Sheets("DATA").Select
Set sh = Sheets("FÖY")
sh.Range("A2:G" & Rows.Count).ClearContents
sonsat = Cells(Rows.Count, "I").End(xlUp).Row
sat = 2
Application.ScreenUpdating = False
For i = 2 To sonsat
If Cells(i, "F").Value >= CDate(ComboBox1.Value) And Cells(i, "F").Value <= _
CDate(ComboBox2.Value) And Cells(i, "I").Value = ComboBox3.Value Then
sh.Cells(sat, "A").Value = Cells(i, "A").Value
sh.Cells(sat, "B").Value = Cells(i, "C").Value
sh.Cells(sat, "C").Value = Cells(i, "D").Value
sh.Cells(sat, "D").Value = Cells(i, "E").Value
sh.Cells(sat, "E").Value = Cells(i, "H").Value
sh.Cells(sat, "F").Value = Cells(i, "G").Value
sh.Cells(sat, "G").Value = Cells(i, "I").Value
sat = sat + 1
End If
Next i
Application.ScreenUpdating = True
sh.Select
Set sh = Nothing
[COLOR="Red"] MsgBox " . . . adet Föy oluşturuldu. ", vbCritical[/COLOR]
End Sub
