1903emre34@gmail.com
Altın Üye
- Katılım
- 29 Mayıs 2016
- Mesajlar
- 946
- Excel Vers. ve Dili
- Microsoft Excel 2013 Türkçe
Merhaba,
Aşağıdaki kodu linkteki dosya uyguladım, ama olmadı
http://s9.dosya.tc/server2/4rbl8z/2016.zip.html
Private Sub CommandButton1_Click()
[E:F] = Empty
f = ThisWorkbook.Path & "\" & "Mizan.xlsx"
Set Aç = New Excel.Application
On Error Resume Next
Aç.Workbooks.Open f
Set hz = Aç.Workbooks(Dir(f))
Set hzs = hz.Sheets(1)
hzs.Columns("A:A").Replace " ", "", xlPart
For a = 6 To Cells(Rows.Count, "B").End(3).Row
If Cells(a, "B") <> "" Then
bc = deg(Cells(a, "A"))
bc = Replace(bc, " ", "")
Set r = hzs.Range("A:A").Find(bc, , xlValues, xlPart, , , False)
If Not r Is Nothing Then
Select Case hzs.Cells(r.Row, "B")
'---------------------------------------
Case 0
'kapalı =0, açık dosyada=0
'--------------------------------------------------
If Cells(a, "C").Value = 0 Then Cells(a, "E") = "KARŞIDA YOK":
'kapalı =0, açık dosyada 0 dan büyük
'--------------------------------------------------
If Cells(a, "C").Value > 0 Then Cells(a, "E") = "YANLIŞ: BURADA FAZLA KARŞIDA SIFIR "
'açık dosyadaki ile kapalı dosyadaki "c" sütunu eşitse
'---------------------------------------------------------
Case Is = Cells(a, "C").Value
Cells(a, "E") = "DOĞRU":
'açık dosyadaki ile kapalı dosyadaki "c" sütunda var ama eşit değil
'-------------------------------------------------------------------------
Case Is <> Cells(a, "C").Value
If Cells(a, "C").Value = 0 And hzs.Cells(r.Row, "B") > 0 Then _
Cells(a, "E") = "YANLIŞ: BURADA FAZLA KARŞIDA SIFIR ": GoTo devam
If Cells(a, "C").Value > 0 And hzs.Cells(r.Row, "B") > 0 Then _
Cells(a, "E") = "YANLIŞ": GoTo devam
'----------------------------------------------------------------
End Select
Else
'----------------------------------------
'açık dosyada var ama kapalı "a" sütununda bulunamadı
If Cells(a, "C") > 0 Then Cells(a, "E") = "DİKKAT"
If Cells(a, "C") = 0 Then Cells(a, "E") = "KARŞIDA YOK"
End If: End If
devam:
If Err > 0 Then
MsgBox "bir hata oluştu programdan çıkılacak"
Exit For
End If
Next
hz.Close SaveChanges:=False
Aç.Quit
Set Aç = Nothing: Set hz = Nothing
End Sub
Function deg(AnyStr As String)
Dim fz
Set fz = CreateObject("vbscript.regexp")
With fz
.Global = True
.Pattern = "[\d]+-"
Set matches = .Execute(sContent)
End With
deg = fz.Replace(AnyStr, "")
deg = Replace(deg, "(-)", "")
Set fz = Nothing
End Function
Aşağıdaki kodu linkteki dosya uyguladım, ama olmadı
http://s9.dosya.tc/server2/4rbl8z/2016.zip.html
Private Sub CommandButton1_Click()
[E:F] = Empty
f = ThisWorkbook.Path & "\" & "Mizan.xlsx"
Set Aç = New Excel.Application
On Error Resume Next
Aç.Workbooks.Open f
Set hz = Aç.Workbooks(Dir(f))
Set hzs = hz.Sheets(1)
hzs.Columns("A:A").Replace " ", "", xlPart
For a = 6 To Cells(Rows.Count, "B").End(3).Row
If Cells(a, "B") <> "" Then
bc = deg(Cells(a, "A"))
bc = Replace(bc, " ", "")
Set r = hzs.Range("A:A").Find(bc, , xlValues, xlPart, , , False)
If Not r Is Nothing Then
Select Case hzs.Cells(r.Row, "B")
'---------------------------------------
Case 0
'kapalı =0, açık dosyada=0
'--------------------------------------------------
If Cells(a, "C").Value = 0 Then Cells(a, "E") = "KARŞIDA YOK":
'kapalı =0, açık dosyada 0 dan büyük
'--------------------------------------------------
If Cells(a, "C").Value > 0 Then Cells(a, "E") = "YANLIŞ: BURADA FAZLA KARŞIDA SIFIR "
'açık dosyadaki ile kapalı dosyadaki "c" sütunu eşitse
'---------------------------------------------------------
Case Is = Cells(a, "C").Value
Cells(a, "E") = "DOĞRU":
'açık dosyadaki ile kapalı dosyadaki "c" sütunda var ama eşit değil
'-------------------------------------------------------------------------
Case Is <> Cells(a, "C").Value
If Cells(a, "C").Value = 0 And hzs.Cells(r.Row, "B") > 0 Then _
Cells(a, "E") = "YANLIŞ: BURADA FAZLA KARŞIDA SIFIR ": GoTo devam
If Cells(a, "C").Value > 0 And hzs.Cells(r.Row, "B") > 0 Then _
Cells(a, "E") = "YANLIŞ": GoTo devam
'----------------------------------------------------------------
End Select
Else
'----------------------------------------
'açık dosyada var ama kapalı "a" sütununda bulunamadı
If Cells(a, "C") > 0 Then Cells(a, "E") = "DİKKAT"
If Cells(a, "C") = 0 Then Cells(a, "E") = "KARŞIDA YOK"
End If: End If
devam:
If Err > 0 Then
MsgBox "bir hata oluştu programdan çıkılacak"
Exit For
End If
Next
hz.Close SaveChanges:=False
Aç.Quit
Set Aç = Nothing: Set hz = Nothing
End Sub
Function deg(AnyStr As String)
Dim fz
Set fz = CreateObject("vbscript.regexp")
With fz
.Global = True
.Pattern = "[\d]+-"
Set matches = .Execute(sContent)
End With
deg = fz.Replace(AnyStr, "")
deg = Replace(deg, "(-)", "")
Set fz = Nothing
End Function
