Locate negative number

  • Thread starter Thread starter BurtArkin
  • Start date Start date
B

BurtArkin

I have a column of numbers (based on an underlying formula), starting
positive at the top. Somewhere in the column, a number becomes negative.
How, using VB code, do I search for that cell, where the number =<0. Once
the cell is located, I want to then alter the formula of the cell to its
left. I would appreciate any help I get. Thanks
 
Hi,

You didn't say what you wanted the formula altered to so this simply enter
123 in the appropriate cell

Sub ordinate()
Set myrange = Range("B1:B" & Cells(Rows.Count, "B").End(xlUp).Row)
For Each c In myrange
If c.Value <> "" And c.Value <= 0 Then
c.Offset(0, -1).Value = 123 ' Do what you want
Exit Sub
End If
Next


Mike
 
Thank you so much for your quick response. I will play with it, and, if
there are any problems (I'm not too swift!), I'll get back to you.
 
Back
Top