- Katılım
- 14 Kasım 2004
- Mesajlar
- 299
- Excel Vers. ve Dili
- microsoft office professional plus 2016
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Private Sub CommandButton1_Click()
Dim syf As String, sat As Long, sut As Integer, c As Range
Application.ScreenUpdating = False
syf = Month(Range("D9"))
With Sheets(syf)
Set c = .Range("A:A").Find(Range("D10"), , xlValues, xlWhole)
If Not c Is Nothing Then
sat = c.Row
End If
Set c = .Rows(3).Find(Range("D9"), , xlValues, xlWhole)
If Not c Is Nothing Then
sut = c.Column
End If
.Cells(sat, sut) = Range("D11")
End With
[COLOR=blue]Range("D10:D11").ClearContents[/COLOR]
MsgBox "Aktarım Yapıldı", , "excel.web.tr"
Application.ScreenUpdating = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("D10")) Is Nothing Then Exit Sub
With Sheets("kayıt")
Set c = .Range("A:A").Find(Range("D10"), , xlValues, xlWhole)
If Not c Is Nothing Then
Range("E10") = .Cells(c.Row, "B")
Else
MsgBox "Hatalı Müşteri Numarası"
Range("E10").ClearContents
End If
End With
End Sub
Sub Rapor_Al()
Dim i As Long, c As Range, sat As Long, sut As Integer
Dim Sr As Worksheet, syf As String
Set Sr = Sheets("rapor")
Application.ScreenUpdating = False
Sheets("giriş").Select
Sr.Range("A2:C" & Rows.Count).ClearContents
Sr.Range("C1") = Range("D9")
syf = Month(Range("D9"))
sat = 2
With Sheets(syf)
Set c = .Rows(3).Find(Range("D9"), , xlValues, xlWhole)
If Not c Is Nothing Then
sut = c.Column
End If
For i = 4 To .Cells(Rows.Count, "A").End(xlUp).Row
If .Cells(i, sut) <> "" Then
Sr.Cells(sat, "A") = .Cells(i, "A")
Sr.Cells(sat, "B") = .Cells(i, "B")
Sr.Cells(sat, "C") = .Cells(i, sut)
sat = sat + 1
End If
Next i
Sr.Cells(sat, "B") = "Toplam"
Sr.Cells(sat, "C") = "=Sum(C2:C" & sat - 1 & ")"
End With
Application.ScreenUpdating = True
End Sub
Sub Rapor_Al()
Dim i As Long, c As Range, sat As Long, sut As Integer
Dim Sr As Worksheet, syf As String
Set Sr = Sheets("rapor")
Application.ScreenUpdating = False
Sheets("giriş").Select
Sr.Range("A2:C" & Rows.Count).ClearContents
Sr.Range("C1") = Range("D9")
syf = Month(Range("D9"))
sat = 2
With Sheets(syf)
Set c = .Rows(3).Find(Range("D9"), , xlValues, xlWhole)
If Not c Is Nothing Then
sut = c.Column
End If
For i = 4 To .Cells(Rows.Count, "A").End(xlUp).Row
If .Cells(i, sut) <> "" Then
Sr.Cells(sat, "A") = .Cells(i, "A")
Sr.Cells(sat, "B") = .Cells(i, "B")
Sr.Cells(sat, "C") = .Cells(i, sut)
sat = sat + 1
End If
Next i
Sr.Cells(sat, "B") = "Toplam"
Sr.Cells(sat, "C") = "=Sum(C2:C" & sat - 1 & ")"
End With
Application.ScreenUpdating = True
End Sub
Ömer bey merhaba,
aşağıdaki verdiğiniz kod güzel çalışıyor ancak bugun bir şey dikatimi çekti; şöyleki
Sub Rapor_Al()
Dim i As Long, c As Range, sat As Long, sut As Integer
Dim Sr As Worksheet, syf As String
Set Sr = Sheets("rapor")
Application.ScreenUpdating = False
Sheets("giriş").Select
[COLOR=blue]If Range("D9") = "" Then Exit Sub
[/COLOR]
Sr.Range("A2:C" & Rows.Count).ClearContents
Sr.Range("C1") = Range("D9")
syf = Month(Range("D9"))
sat = 2
With Sheets(syf)
Set c = .Rows(3).Find(Range("D9"), , xlValues, xlWhole)
If Not c Is Nothing Then
sut = c.Column
End If
For i = 4 To .Cells(Rows.Count, "A").End(xlUp).Row
If .Cells(i, sut) <> "" Then
Sr.Cells(sat, "A") = .Cells(i, "A")
Sr.Cells(sat, "B") = .Cells(i, "B")
Sr.Cells(sat, "C") = .Cells(i, sut)
sat = sat + 1
End If
Next i
Sr.Cells(sat, "B") = "Toplam"
Sr.Cells(sat, "C") = "=Sum(C2:C" & sat - 1 & ")"
End With
Application.ScreenUpdating = True
End Sub