View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Turn +ve to -ve & vice versa.

I should have included this to catch text

For Each c In myrange
On Error Resume Next

Mike

"Mike H" wrote:

Middling length but it doesn't destry formulas

Sub test()
Dim myrange As Range
LastRow = Cells(Cells.Rows.Count, "L").End(xlUp).Row
Set myrange = Range("L2:L" & LastRow)
For Each c In myrange
If c.Value = "abc" Then
If Not c.Offset(0, -9).HasFormula Then
c.Offset(0, -9).Value = c.Offset(0, -9).Value * (-1)
End If
End If
Next
End Sub

Mike

"Sinner" wrote:

Hi,

How do I do that in VB?
For each value 'abc' is found in columnL starting from cell L2 then
turn values in columnE starting C2 positive to negative (vice versa)

Thanks