# Office 365 >  >  Macro Help -- Change Values to negative if a cell in same row contains certain verbiage

## 8Alanna8

Hello!
I'm hoping to get some help with an excel Macro.
I have a worksheet where range B8:B500 contains document types and range E8:E500 contains dollar values.

I'm looking to have the dollar values indicated in column E converted to negative dollar values if the B cell in the same row contains the word "Payments" or "Credit Notes".

Can anyone help me?

Thank you so much in advance for your help!!

----------


## JLGWhiz

```
Please Login or Register  to view this content.
```

----------


## 8Alanna8

Thank you JLGWhiz; however it's giving me a Run-time error '13'  Type Mismatch?

----------


## 8Alanna8

Nevermind!  I fixed it! 
Sub goNegative()
Dim c As Range
    For Each c In Range("B8:B500")
        If InStr(c.Text, "Payments") > 0 Or InStr(c.Text, "Credit Notes") > 0 Then
            c.Offset(, 3) = c.Offset(, 3).Value * (-1)
        End If
    Next
End Sub

Thank you so much for your help!!!

----------


## Crooza

Hi and Welcome. Try this but note that the spelling must be exactly as you put in your post with Capital letters etc for *P*ayments and *C*redit *N*otes




```
Please Login or Register  to view this content.
```

----------


## JLGWhiz

> Nevermind!  I fixed it! 
> Sub goNegative()
> Dim c As Range
>     For Each c In Range("B8:B500")
>         If InStr(c.Text, "Payments") > 0 Or InStr(c.Text, "Credit Notes") > 0 Then
>             c.Offset(, 3) = c.Offset(, 3).Value * (-1)
>         End If
>     Next
> End Sub
> ...



You're welcome,
Regards, JLG

----------

