• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Find a letter "O" and convert the number in Negative in another Range

Hello Friends,

Need your help here ..I need to find a letter "O" from the range column T and convert the existing number in column L to negative.

For Example:

Row no 10 having 71.58 should be changed to -71.58
similarly Row no 26 should be also changed to -71.58.

Appreciate your help on the same.

upload_2019-1-21_21-32-0.png
 

Attachments

  • upload_2019-1-21_21-30-31.png
    upload_2019-1-21_21-30-31.png
    23.4 KB · Views: 9
  • upload_2019-1-21_21-31-22.png
    upload_2019-1-21_21-31-22.png
    20.9 KB · Views: 2
  • MASTER_123.xlsx
    12 KB · Views: 4
Code:
Sub O_Negative()

Dim LstRow As String
Dim Rng As Range
Dim SubRng As Range

LstRow = Cells(Rows.Count, "L").End(xlUp).Row
Set Rng = Range("T2:T" & LstRow)

For Each SubRng In Rng
    If SubRng = "O" Then
        Range("L" & SubRng.Row) = Range("L" & SubRng.Row) * -1
    End If
Next SubRng

End Sub
 
Hi !

According to the attachment, an Excel way :​
Code:
Sub Demo1()
    V = ActiveSheet.UsedRange.Rows.Count
    Range("L2:L" & V).Value2 = Evaluate(Replace("IF(T2:T#=""O"",-L2:L#,L2:L#)", "#", V))
End Sub
Do you like it ? So thanks to click on bottom right Like !
 
Back
Top