• DİKKAT

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

Sayıların pozitife çevrilmesi hak.

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
İyi günler,

"G" sütündaki bazı tutarları negatif yer almaktadır, onun pozitif çevrilmesi için aşağıdaki kod ek ilave yapabilir miyiz?

Kod:
Sub Duzenle()

    Dim i As Long, sat As Long, son As Long, a
    
    son = Cells(Rows.Count, "A").End(xlUp).Row
    
    sat = 1
    For i = 1 To son
        sat = Cells(sat, "A").End(xlDown).Row
        If IsNumeric(Cells(sat, "A")) = False Then
            a = Split(Cells(sat, "A"), " ")
            Cells(sat, "B") = a(UBound(a))
        End If
        If sat = son Then Exit For
    Next i
    
    [B:B].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  
End Sub
 
Merhaba.
Aşağıdaki kodları kullanabilirsiniz.

Kod:
Sub Duzenle()
    Dim i As Long, sat As Long, son As Long, a
    son = Cells(Rows.Count, "A").End(xlUp).Row
    sat = 1
    For i = 1 To son
        sat = Cells(sat, "A").End(xlDown).Row
        If IsNumeric(Cells(sat, "A")) = False Then
            a = Split(Cells(sat, "A"), " ")
            Cells(sat, "B") = a(UBound(a))
        End If

        'If sat = son Then Exit For
    Next i
    [B:B].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    Negatif_Pozitif
End Sub

Sub Negatif_Pozitif()
    Dim i As Long
    son = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To son
        If IsNumeric(Cells(i, "G")) = True And Cells(i, "G") < 0 Then
            Cells(i, "G") = Cells(i, "G") * (-1)
        End If
    Next
End Sub
 
Teşekkürler, negatifden pozitif hale çevirmektedir. sayıların arasındaki son iki hane nokta diğerlerin vrigül gelmesi için kodlarda değişiklik yapabilir miyiz
 

Ekli dosyalar

Alternatif.:cool:
Kod:
Sub Duzenle()
    Dim i As Long, sat As Long, son As Long, a
    son = Cells(Rows.Count, "A").End(xlUp).Row
    sat = 1
    For i = 1 To son
        sat = Cells(sat, "A").End(xlDown).Row
        If IsNumeric(Cells(sat, "A")) = False Then
            a = Split(Cells(sat, "A"), " ")
            Cells(sat, "B") = a(UBound(a))
        End If
        Cells(i, "G").Value = Abs(Cells(i, "G").Value)
        'If sat = son Then Exit For
    Next i
    [B:B].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
 
Geri
Üst