• DİKKAT

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

belli Digit sayısıdından fazla ise alan kodu ekleme

Kemal Demir

Özel Üye
Katılım
29 Temmuz 2004
Mesajlar
2,108
Gunaydın arkadaslar.

elimde ki dodda
ile bağlı olarak b kolonundaki telefon numaralarına alan kodu ekliyor

yalnız
alan kodu eklemesi için bir şart koymam gerekiyor

1.)7 digitten fazla olmayacak azda olmayacak.
7 digitten fazla olanlara alan kodu eklemeyecel

**kod***
Sub alankoduekle()
For C = 2 To 13
If Cells(C, 1).Value = "İZMİR" Then
Cells(C, 2).Value = "232" & Cells(C, 2).Value
End If
If Cells(C, 1).Value = "ANKARA" Then
Cells(C, 2).Value = "312" & Cells(C, 2).Value
End If
If Cells(C, 1).Value = "BURSA" Then
Cells(C, 2).Value = "224" & Cells(C, 2).Value
End If
If Cells(C, 1).Value = "SAMSUN" Then
Cells(C, 2).Value = "362" & Cells(C, 2).Value
End If
If Cells(C, 1).Value = "ADANA" Then
Cells(C, 2).Value = "322" & Cells(C, 2).Value
End If
If Cells(C, 1).Value = "ANTALYA" Then
Cells(C, 2).Value = "242" & Cells(C, 2).Value
End If
Cells(C, 2).NumberFormat = "(###) ### ## ##"
Next
End Sub
****************************************
buraya nasıl bir ilave yapabiliriz.

Yardımcı olursanız sevinirim.

İyi Çalışmalar.
 
Digit Sayısını sorgulayacak bir koda ihtiyacım var 7 den fazla ıse yukarıdaki donuler gerçekleşmesin aşağı isede gerçekleşmesin
Sadece digit sayısı 7 ise gerçekleşssin.
 
Aşağıdaki gibi deneyin.

[vb:1:312d47b832]Sub alankoduekle()
For C = 2 To 13
if len(cells(C,1))=7 then
If Cells(C, 1).Value = "İZMİR" Then
Cells(C, 2).Value = "232" & Cells(C, 2).Value
End If
If Cells(C, 1).Value = "ANKARA" Then
Cells(C, 2).Value = "312" & Cells(C, 2).Value
End If
If Cells(C, 1).Value = "BURSA" Then
Cells(C, 2).Value = "224" & Cells(C, 2).Value
End If
If Cells(C, 1).Value = "SAMSUN" Then
Cells(C, 2).Value = "362" & Cells(C, 2).Value
End If
If Cells(C, 1).Value = "ADANA" Then
Cells(C, 2).Value = "322" & Cells(C, 2).Value
End If
If Cells(C, 1).Value = "ANTALYA" Then
Cells(C, 2).Value = "242" & Cells(C, 2).Value
End If
Cells(C, 2).NumberFormat = "(###) ### ## ##"
Next
end if
End Sub
[/vb:1:312d47b832]
 
Sn leventm Çok Teşekkur Ederim.
 
Geri
Üst