Bypas Nil Values

A

a m spock

A formula delivers a result 0 or 1 in certain conditions in the cells in a
coluumn.

I need to start scanning from row 1 to bypass the initial 0 value cells to
reach the first positive value in the column.

How do I do it?
 
M

Mike H

Hi,

A bit thin on information but maybe this will get you started

Sub sonic()
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set myrange = Range("A1:A" & lastrow)
For Each c In myrange
If c.Value <> 0 Then
'do something
MsgBox c.Address
End If
Next
End Sub

Mike
 
D

Don Guillett

See reply in your other post. Why did you do this???
in a columnGet to first positive value

e: Bypas Nil Values
 
A

a m spock

the data in the computed column on sales completed is something like this.
the data is dynamic and changes as each transaction is added to the workshet.
i need a macro which will, starting from anywhere on the worksheet take the
cursor to the cell with the last positive value i.e. 800,000

Trades Completed
0
200,000
1,000
1,000,000
0
0
0
0
800,000
0
0
0
 
D

Don Guillett

One way

Sub gotolastpostitivevalue()
mc = "f"
For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1
If Cells(i, mc) > 0 Then
Cells(i, mc).Select
Exit Sub
End If
Next i
End Sub
 
A

a m spock

many thanks. the macro works but
it has selected a column at random where it finds the last positive value
evry time. how do i specify the column where i want the avtivity to happen?

Pardon my ignorance.
 
A

a m spock

don,
you can't imagine how grateful i am.
am

Don Guillett said:
Just in case.
mc="f" refers to column F. change to suit.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top