ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Bypas Nil Values (https://www.excelbanter.com/excel-programming/416758-bypas-nil-values.html)

a m spock

Bypas Nil Values
 
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?


Mike H

Bypas Nil Values
 
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

"a m spock" wrote:

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?


Don Guillett

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

e: Bypas Nil Values


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"a m spock" wrote in message
...
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?



a m spock

Bypas Nil Values
 

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



Don Guillett

Bypas Nil Values
 
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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"a m spock" wrote in message
...

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




a m spock

Bypas Nil Values
 
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.

"Don Guillett" wrote:

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"a m spock" wrote in message
...

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





a m spock

Bypas Nil Values
 
sorry fro prev post. just figured it out.
thanks again!!!

"Don Guillett" wrote:

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"a m spock" wrote in message
...

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





Don Guillett

Bypas Nil Values
 
Just in case.
mc="f" refers to column F. change to suit.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"a m spock" wrote in message
...
sorry fro prev post. just figured it out.
thanks again!!!

"Don Guillett" wrote:

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"a m spock" wrote in message
...

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






a m spock

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

"Don Guillett" wrote:

Just in case.
mc="f" refers to column F. change to suit.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"a m spock" wrote in message
...
sorry fro prev post. just figured it out.
thanks again!!!

"Don Guillett" wrote:

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"a m spock" wrote in message
...

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








All times are GMT +1. The time now is 07:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com