- Katılım
- 3 Mart 2009
- Mesajlar
- 519
- Excel Vers. ve Dili
- excel 2003 tr
Arkadaşlar kırmızı ile işaretlediğim kod çalışıyor fakat yanlış sonuc veriyor bunu nasıl çözebilirim?
Option Explicit
Sub PROJE1()
Dim ss1 As Integer, ss2 As Integer, say As Integer, maxsumum As Integer, Uzunluk As Integer, cıkart As Integer, sonuc1 As Integer
Dim i, e, sonuc, sonuc11, Birlestir, a1, yinele
Dim shf1, shf2 As Worksheet
Dim hucre, hucre1 As Range
Set shf2 = Sheets("VG")
Set shf1 = Sheets("PROJE")
ss1 = shf1.Range("C65500").End(3).Row
ss2 = shf2.Range("A65500").End(3).Row
shf1.Range("B3:B" & ss1).ClearContents
say = Sheets("HES").ListBox1.ListCount - 1
For i = 0 To say
If Sheets("HES").ListBox1.Selected(i) = True Then
Birlestir = ""
For e = 1 To 50
If shf2.Cells(i + 5, e).Value = Empty Then
a1 = ""
Else
a1 = " "
End If
'.....................................................................
If e = 1 Then
Birlestir = shf2.Cells(i + 5, e).Value & a1
Else
shf1.Cells(i + 3, e + 3).Value = Len(shf2.Cells(i + 5, e - 1).Value)
For Each hucre1 In shf1.Cells(2, e + 3)
sonuc1 = hucre1.Value
Next hucre1
shf1.Cells(1, e + 3) = sonuc1
maxsumum = shf1.Cells(1, e + 3).Value
Uzunluk = Len(shf2.Cells(i + 5, e - 1).Value)
cıkart = maxsumum - Uzunluk 'Çıkarma işlemi neden doğru sonuç vermiyor ?
yinele = Application.WorksheetFunction.Rept(" ", cıkart)
shf1.Cells(i + 25, e + 3).Value = cıkart
Birlestir = Birlestir & yinele & shf2.Cells(i + 5, e).Value & a1
End If
Next e
shf1.Cells(i + 3, 3).Value = Birlestir
'.....................................................................
End If
Next i
For Each hucre In shf1.Range("C3:C50")
If UCase(hucre.Value) = Empty Then
sonuc = sonuc & hucre.Value
Else
sonuc = sonuc & hucre.Value & Chr(10)
End If
Next hucre
shf1.Range("B3").Value = sonuc
Call LİSTBOX1
shf1.Range("C3:BA" & ss2).ClearContents
End Sub
