Excel

Closed
Bkp - Jan 22, 2016 at 06:09 AM
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - Jan 22, 2016 at 06:55 AM
Hello,

if the column a and column b are equal, i want to put "-"(minus sign) before the data of column b for further technical purpose.
eg. it looks like tiger tiger, i want to put minus symbol infront of column b tiger, so it should look like -tiger in column b.
plz tell me how to do it...

Related:

1 response

vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 262
Jan 22, 2016 at 06:55 AM
Hello BKP,

Try the following code in a standard module:-

Sub Test()

Dim lr As Long

lr = Range("A" & Rows.Count).End(xlUp).Row

For i = 2 To lr
          If Cells(i, 2).Value = Cells(i, 1).Value Then
          Cells(i, 2) = "-" & Cells(i, 1).Value
    End If
Next

End Sub


It should do the task for you.

Following is a link to my test work book for you to see and try. Just click on the button to see it work:-

https://www.dropbox.com/s/bdi5r4hqwkmhggw/BKP.xlsm?dl=0

I hope that this helps.

Cheerio,
vcoolio.
0