Option Explicit
Sub Kosullu_Satir_Sil()
Dim Zaman As Double, Veri As Variant, X As Long, Y As Byte
Dim Son As Long, Say As Long, Silinen_Satir_Say As Long
Zaman = Timer
Application.ScreenUpdating = 0
Application.Calculation = -4135
Son = Cells(Rows.Count, 2).End(3).Row
If Son <= 2 Then Son = 3
Veri = Range("A2:X" & Son).Value
ReDim Liste(1 To Son, 1 To 26)
For X = LBound(Veri, 1) To UBound(Veri, 1)
If Veri(X, 23) <> "Aktif" Then
Say = Say + 1
For Y = 1 To 26
If Y < 25 Then
Liste(Say, Y) = Veri(X, Y)
ElseIf Y = 25 Then
Liste(Say, Y) = Cells(X + 1, 3).Font.Color
ElseIf Y = 26 Then
Liste(Say, Y) = Cells(X + 1, 3).Interior.Color
End If
Next
Else
Silinen_Satir_Say = Silinen_Satir_Say + 1
End If
Next
If Silinen_Satir_Say > 0 Then
Range("A2:X" & Rows.Count).ClearContents
Range("A2:X" & Rows.Count).Borders.LineStyle = 0
Range("C2:C" & Rows.Count).Font.Color = xlNone
Range("T2:T" & Rows.Count).Interior.Color = 16777215
Range("A2:A" & Rows.Count).Interior.Color = 16777215
Range("V2:V" & Rows.Count).FormatConditions.Delete
Range("A2").Resize(Say, 24) = Liste
Son = Cells(Rows.Count, 2).End(3).Row
If Son <= 2 Then Son = 3
Veri = Range("A2:X" & Son).Value
For X = LBound(Veri, 1) To UBound(Veri, 1)
Cells(X + 1, 3).Font.Color = Liste(X, 25)
Cells(X + 1, 3).Interior.Color = Liste(X, 26)
Next
Range("A2").Resize(Say, 24).Borders.LineStyle = 1
Range("A2:A" & Cells(Rows.Count, 2).End(3).Row).Interior.Color = 5296274
Range("T2:T" & Cells(Rows.Count, 2).End(3).Row).Interior.Color = 15773696
With Range("V2:V" & Cells(Rows.Count, 2).End(3).Row)
.FormatConditions.Add Type:=xlExpression, Formula1:="=U2<0"
.FormatConditions(1).Interior.Color = 255
.FormatConditions(1).StopIfTrue = False
.FormatConditions.Add Type:=xlExpression, Formula1:="=U2<30"
.FormatConditions(2).Interior.Color = 65535
.FormatConditions(2).StopIfTrue = False
.FormatConditions.Add Type:=xlExpression, Formula1:="=U2>30"
.FormatConditions(3).Interior.Color = 5296274
.FormatConditions(3).StopIfTrue = False
End With
With Range("U2:U" & Cells(Rows.Count, 2).End(3).Row)
.Formula = "=IF(T2="""","""",DAYS360($AD$1,T2))"
End With
With Range("V2:V" & Cells(Rows.Count, 2).End(3).Row)
.Formula = "=IF(T2="""","""",IF(0>U2,""SURESI DOLDU"","""")&"" ""&IF(U2<30,""(UYARI)"","""")&""""&IF(U2>30,""GECERLI"","""")&"""")"
End With
Application.Calculation = -4105
Application.ScreenUpdating = 1
MsgBox "Tablonuzdaki W sütununda ""Aktif"" ifadesini içeren satırlar temizlenmiştir." & vbLf & vbLf & _
"İşlem süresi ; " & Format(Timer - Zaman, "0.00") & " Saniye"
Else
Application.Calculation = -4105
Application.ScreenUpdating = 1
MsgBox "Silinecek kayıt bulunamadı!", vbExclamation
End If
End Sub