asdsxx
Altın Üye
- Katılım
- 22 Mayıs 2012
- Mesajlar
- 500
- Excel Vers. ve Dili
- Excel 2016 Türkçe
- Altın Üyelik Bitiş Tarihi
- 20-02-2027
Arkadaşlar daha önce bu formdaki bir arkadaşın yardımıyla bir makro kodu yardımı olmuştu. Makronun çalışma mantığı şu idi Excel hücresindeki cümlede baştaki sırayı belirten rakam ve sayılar hariç cümle içinde dipnot veya farklı amaçla yazılmış rakamları temizliyordu. Ama bu rakamlar üstlü sayı şeklinde olursa temizlemiyor. Koda nasıl bir ilave yazabiliriz.
Kod:
Sub Sayilari_Temizle()
Dim Veri As Range, Bul As Integer, Metin As String
With CreateObject("VBscript.RegExp")
.Global = True
.Pattern = "[0-9]"
For Each Veri In Selection
Bul = InStr(1, Veri.Value, ".")
If Bul > 0 Then
Metin = Mid(Veri.Value, Bul + 1, Len(Veri.Value) - Bul)
Veri.Value = Mid(Veri.Value, 1, Bul) & .Replace(Metin, "")
End If
Next
End With
MsgBox "İşleminiz tamamlanmıştır.", vbInformation
End Sub
Örnek:

Kod:
Sub Sayilari_Temizle()
Dim Veri As Range, Bul As Integer, Metin As String
With CreateObject("VBscript.RegExp")
.Global = True
.Pattern = "[0-9]"
For Each Veri In Selection
Bul = InStr(1, Veri.Value, ".")
If Bul > 0 Then
Metin = Mid(Veri.Value, Bul + 1, Len(Veri.Value) - Bul)
Veri.Value = Mid(Veri.Value, 1, Bul) & .Replace(Metin, "")
End If
Next
End With
MsgBox "İşleminiz tamamlanmıştır.", vbInformation
End Sub
Örnek:
