• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

birleştir ve left kodlarıyla macro yazmak

mersilen

Destek Ekibi
Destek Ekibi
Katılım
31 Aralık 2009
Mesajlar
1,105
Excel Vers. ve Dili
excel 2007 türkçe
Excel Vers. ve Dili Ofis 2003
Selamlar

Yapmak istediğim CZ8 hücresine DA8: DI8 deki sayıları birleştirirken her sayıdan sonra 1 satırdaki DA1: DI1 deki kelimelerin ilk harflerini getirmek(sadece DD1 deki 2 harf gelecek--olmasada olur)

birşeyler yapmaya çalıştım ama olmadı

Kod:
sat1=1
sat2=8

for sü to 9
 
  if sü=4  then x=2 else x=1   end if 
savunma1 = aplication.worksheetfunction.left(cell(sü;sat1);x)
 savunma2=cells(süt;sat2).value + savunma 1
savunma=savunma1 + savunma2

next sü

range("cz" & "sat2")=savunma
 

Ekli dosyalar

Son düzenleme:
Merhaba,

Bu şekilde deneyiniz.

Kod:
Sub BirlestirYaz()

    Dim i As Byte, sayi As Byte

    Range("CZ8").ClearContents
    
    For i = 105 To 113
        sayi = 1
        If i = 108 Then sayi = 2
        Range("CZ8") = Range("CZ8") & Cells(8, i) & Left(Cells(1, i), sayi)
    Next i

End Sub

.
 
Ömer hocam , hızır gibisiniz valla

çok teşekkürler

kodu biraz kendime göre değiştirdim
Kod:
Sub BirlestirYaz()

Dim i As Byte, sayi As Byte
   Application.Calculation = xlManual
    Range("CZ8").ClearContents
    
    For i = 105 To 113
      If Cells(8, i).Value <> "" Then
        sayi = 1
        If i = 108 Then sayi = 2
        Range("CZ8") = Range("CZ8") & Cells(8, i) & Left(Cells(1, i), sayi)
      End If
    Next i
    Application.Calculation = xlAutomatic
End Sub
 
Ömer hocam
tekrar merhaba

macroya satırları birer artırmak için bir döngü daha ekleyim dedim ama olmadı
hep ilk satırın sonucunu cz8:cz 18 e yazıyor
ayrıca clearcontents ide çalışmıyor
Kod:
Sub BirlestirYaz()
Dim i As Byte, sayi As Byte
y = ""
Application.ScreenUpdating = False
Application.Calculation = xlManual
   
   [COLOR="Red"] For sat = 8 To 18[/COLOR]
      ' Range("CZ8").ClearContents
        [COLOR="Red"]Cells(sat, 104).ClearContents[/COLOR]
      For i = 105 To 113
        If Cells(sat, i).Value <> "" Then
          sayi = 1
          If i = 108 Then sayi = 2
           y = y & Cells(sat, i) & Left(Cells(1, i), sayi)
      
          End If
       Next i
       Cells(sat, 104) = y
    [COLOR="Red"]Next sat[/COLOR]
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
 
Merhaba,

Alternatif olarak aşağıdaki kodu denermisiniz.

Kod:
Option Explicit
 
Sub BİRLEŞTİR_LİSTELE()
    Dim X As Integer, Y As Byte
    
    Application.ScreenUpdating = False
    
    For X = 8 To 18
        Cells(X, 104).ClearContents
        For Y = 105 To 113
            Cells(X, 104) = Cells(X, 104) & Cells(X, Y) & IIf(Y = 108, Left(Cells(1, Y), 2), Left(Cells(1, Y), 1))
        Next
    Next
 
    Application.ScreenUpdating = True
    
    MsgBox "İşleminiz tamamlanmıştır.", vbInformation
End Sub
 
Ömer hocam
tekrar merhaba

macroya satırları birer artırmak için bir döngü daha ekleyim dedim ama olmadı
hep ilk satırın sonucunu cz8:cz 18 e yazıyor
ayrıca clearcontents ide çalışmıyor

Bu şekilde deneyiniz.

Kod:
Sub BirlestirYaz()

    Dim i As Byte, sayi As Byte, j As Byte
    
    Application.ScreenUpdating = False
    Application.Calculation = xlManual

    Range("CZ8:CZ18").ClearContents
    
    For i = 8 To 18
      For j = 105 To 113
        If Cells(i, j) <> "" Then
          sayi = 1
          If j = 108 Then sayi = 2
         Cells(i, "CZ") = Cells(i, "CZ") & Cells(i, j) & Left(Cells(1, j), sayi)
        End If
      Next j
    Next i
    
    Application.Calculation = xlAutomatic
    Application.ScreenUpdating = True
    
End Sub


.
 
tekrar teşekkürler Ömer hocam
 
Geri
Üst