dengeceteris
Altın Üye
- Katılım
- 21 Aralık 2019
- Mesajlar
- 204
- Excel Vers. ve Dili
- Office 2016
- Altın Üyelik Bitiş Tarihi
- 15-06-2025
Sevgili arkadaşlar bir sorum olacak. Uzun süredir kullandığım ama bir noktada revize ihtiyacı duyduğum bir formülüm var. Zaten yine bu sitede arkadaşlar yazıvermişti. İstediğim ise formülün sonucu: #SAYI/0! veya #DEĞER! geldiği zaman mesela 0'a bölünemez gibi bir durum oluşunca bu hata kodlarını vermeden boş bırakıp farklı bir renge o hücreyi boyasa mümkün mü acaba ?
Sub FİNANSAL_ANALİZ()
Set sV = Sheets("ANAMİZAN")
Set Sa = Sheets("ANALİZ")
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
End With
son = Sa.Cells(Rows.Count, 1).End(3).Row
For i = 2 To son
If Sa.Cells(i, 1) <> "" Then
Sa.Range("D" & i & "
" & i).ClearContents
End If
Next
liste = sV.Range("BI3:BN" & sV.Cells(Rows.Count, 1).End(3).Row).Value
Dim w(1 To 3)
With CreateObject("Scripting.Dictionary")
For i = LBound(liste) To UBound(liste)
For ii = 1 To 3
al = Val(liste(i, ii))
If .Exists(al) Then
z = .Item(al)
z(1) = z(1) + liste(i, 4)
.Item(al) = z
Else
z = w
z(1) = liste(i, 4)
.Item(al) = z
End If
Next ii
Next i
Sa.Select
son = Sa.Cells(Rows.Count, 1).End(3).Row
For i = 2 To son
Dim col As New Collection
al = Sa.Cells(i, 1)
If al <> "" Then
a = "="
onc_nm = False
For ii = 1 To Len(al)
b = Mid(al, ii, 1)
If IsNumeric(b) Or b = "." Then nm = True Else nm = False
If nm <> onc_nm Then
col.Add a
a = b
Else
a = a & b
End If
onc_nm = nm
Next ii
col.Add a
f1 = ""
f2 = ""
If col.Count > 0 Then
For iii = 1 To col.Count
If IsNumeric(col(1)) And Len(col(1)) < 4 And InStr(col(1), ".") = 0 Then
If .Exists(Val(col(1))) Then
z = .Item(Val(col(1)))
Else
z(1) = 0
z(2) = 0
End If
f1 = f1 & z(1)
Else
f1 = f1 & col(1)
End If
col.Remove 1
Next iii
End If
Sa.Cells(i, "D") = Evaluate(Replace(f1, ",", "."))
End If
Next i
End With
With Application
.ScreenUpdating = True
.Calculation = xlAutomatic
.EnableEvents = True
End With
End Sub
Sub FİNANSAL_ANALİZ()
Set sV = Sheets("ANAMİZAN")
Set Sa = Sheets("ANALİZ")
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
End With
son = Sa.Cells(Rows.Count, 1).End(3).Row
For i = 2 To son
If Sa.Cells(i, 1) <> "" Then
Sa.Range("D" & i & "
End If
Next
liste = sV.Range("BI3:BN" & sV.Cells(Rows.Count, 1).End(3).Row).Value
Dim w(1 To 3)
With CreateObject("Scripting.Dictionary")
For i = LBound(liste) To UBound(liste)
For ii = 1 To 3
al = Val(liste(i, ii))
If .Exists(al) Then
z = .Item(al)
z(1) = z(1) + liste(i, 4)
.Item(al) = z
Else
z = w
z(1) = liste(i, 4)
.Item(al) = z
End If
Next ii
Next i
Sa.Select
son = Sa.Cells(Rows.Count, 1).End(3).Row
For i = 2 To son
Dim col As New Collection
al = Sa.Cells(i, 1)
If al <> "" Then
a = "="
onc_nm = False
For ii = 1 To Len(al)
b = Mid(al, ii, 1)
If IsNumeric(b) Or b = "." Then nm = True Else nm = False
If nm <> onc_nm Then
col.Add a
a = b
Else
a = a & b
End If
onc_nm = nm
Next ii
col.Add a
f1 = ""
f2 = ""
If col.Count > 0 Then
For iii = 1 To col.Count
If IsNumeric(col(1)) And Len(col(1)) < 4 And InStr(col(1), ".") = 0 Then
If .Exists(Val(col(1))) Then
z = .Item(Val(col(1)))
Else
z(1) = 0
z(2) = 0
End If
f1 = f1 & z(1)
Else
f1 = f1 & col(1)
End If
col.Remove 1
Next iii
End If
Sa.Cells(i, "D") = Evaluate(Replace(f1, ",", "."))
End If
Next i
End With
With Application
.ScreenUpdating = True
.Calculation = xlAutomatic
.EnableEvents = True
End With
End Sub