Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Find not equal to "0"

Hi

I want to find the first cell that is not zero "0" across a row. I have
tried the following but is gives a syntax error. (I've searched this forum
but cannot find anything that helps me)

Cells.Find(What:<"0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate

Any help will be greatly appreciated.

Mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Find not equal to "0"

There's nothing like find something not equal to in excel.

Since it's only a single row, maybe you can just go through each column until
you find what you want.

Mark wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I have
tried the following but is gives a syntax error. (I've searched this forum
but cannot find anything that helps me)

Cells.Find(What:<"0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate

Any help will be greatly appreciated.

Mark


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Find not equal to "0"

Would take too long Dave

Cheers

"Dave Peterson" wrote in message
...
There's nothing like find something not equal to in excel.

Since it's only a single row, maybe you can just go through each column
until
you find what you want.

Mark wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I have
tried the following but is gives a syntax error. (I've searched this
forum
but cannot find anything that helps me)

Cells.Find(What:<"0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate

Any help will be greatly appreciated.

Mark


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Find not equal to "0"

Did you try looping through 256 columns (xl2003 and below) or 16k in xl2007--or
even just through the usedrange.

I'm surprised that you could notice the delay.

Mark wrote:

Would take too long Dave

Cheers

"Dave Peterson" wrote in message
...
There's nothing like find something not equal to in excel.

Since it's only a single row, maybe you can just go through each column
until
you find what you want.

Mark wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I have
tried the following but is gives a syntax error. (I've searched this
forum
but cannot find anything that helps me)

Cells.Find(What:<"0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate

Any help will be greatly appreciated.

Mark


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Find not equal to "0"

Well, I guess there are ways in Excel to find something not equal to in
Excel. The following macro selects the first non-zero value in each row of
a selected range. If just a single cell is selected, the macro will select
such non-zero values for the whole worksheet.

Cheers,

Joerg Mochikun

Sub FindFirstNonZeroInEachRow()
Dim rng, MyArea As Range
Dim RowNumber
If Selection.Cells.Count = 1 Then
Set rng = ActiveSheet.UsedRange
Else
Set rng = Intersect(ActiveSheet.UsedRange, Selection)
End If
For Each cell In rng
If cell.Value < 0 And RowNumber < cell.Row Then
If MyArea Is Nothing Then Set MyArea = cell
Set MyArea = Union(MyArea, cell)
RowNumber = cell.Row
End If
Next cell
If MyArea Is Nothing Then
MsgBox "No non-zero values found!"
Else
MyArea.Select
End If
End Sub





"Mark" wrote in message
...
Hi

I want to find the first cell that is not zero "0" across a row. I have
tried the following but is gives a syntax error. (I've searched this forum
but cannot find anything that helps me)

Cells.Find(What:<"0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate

Any help will be greatly appreciated.

Mark





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Find not equal to "0"

Many thanks Joerg

I'll give it a go

Mark

"Joerg" wrote in message
...
Well, I guess there are ways in Excel to find something not equal to in
Excel. The following macro selects the first non-zero value in each row
of a selected range. If just a single cell is selected, the macro will
select such non-zero values for the whole worksheet.

Cheers,

Joerg Mochikun

Sub FindFirstNonZeroInEachRow()
Dim rng, MyArea As Range
Dim RowNumber
If Selection.Cells.Count = 1 Then
Set rng = ActiveSheet.UsedRange
Else
Set rng = Intersect(ActiveSheet.UsedRange, Selection)
End If
For Each cell In rng
If cell.Value < 0 And RowNumber < cell.Row Then
If MyArea Is Nothing Then Set MyArea = cell
Set MyArea = Union(MyArea, cell)
RowNumber = cell.Row
End If
Next cell
If MyArea Is Nothing Then
MsgBox "No non-zero values found!"
Else
MyArea.Select
End If
End Sub





"Mark" wrote in message
...
Hi

I want to find the first cell that is not zero "0" across a row. I have
tried the following but is gives a syntax error. (I've searched this
forum but cannot find anything that helps me)

Cells.Find(What:<"0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate

Any help will be greatly appreciated.

Mark





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Find not equal to "0"

Errrrr. This is looping through the cells.

Mark wrote:

Many thanks Joerg

I'll give it a go

Mark

"Joerg" wrote in message
...
Well, I guess there are ways in Excel to find something not equal to in
Excel. The following macro selects the first non-zero value in each row
of a selected range. If just a single cell is selected, the macro will
select such non-zero values for the whole worksheet.

Cheers,

Joerg Mochikun

Sub FindFirstNonZeroInEachRow()
Dim rng, MyArea As Range
Dim RowNumber
If Selection.Cells.Count = 1 Then
Set rng = ActiveSheet.UsedRange
Else
Set rng = Intersect(ActiveSheet.UsedRange, Selection)
End If
For Each cell In rng
If cell.Value < 0 And RowNumber < cell.Row Then
If MyArea Is Nothing Then Set MyArea = cell
Set MyArea = Union(MyArea, cell)
RowNumber = cell.Row
End If
Next cell
If MyArea Is Nothing Then
MsgBox "No non-zero values found!"
Else
MyArea.Select
End If
End Sub





"Mark" wrote in message
...
Hi

I want to find the first cell that is not zero "0" across a row. I have
tried the following but is gives a syntax error. (I've searched this
forum but cannot find anything that helps me)

Cells.Find(What:<"0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate

Any help will be greatly appreciated.

Mark




--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Find not equal to "0"

Many thanks Joerg

I'll give it a go

Mark

"Joerg" wrote in message
...
Well, I guess there are ways in Excel to find something not equal to in
Excel. The following macro selects the first non-zero value in each row
of a selected range. If just a single cell is selected, the macro will
select such non-zero values for the whole worksheet.

Cheers,

Joerg Mochikun

Sub FindFirstNonZeroInEachRow()
Dim rng, MyArea As Range
Dim RowNumber
If Selection.Cells.Count = 1 Then
Set rng = ActiveSheet.UsedRange
Else
Set rng = Intersect(ActiveSheet.UsedRange, Selection)
End If
For Each cell In rng
If cell.Value < 0 And RowNumber < cell.Row Then
If MyArea Is Nothing Then Set MyArea = cell
Set MyArea = Union(MyArea, cell)
RowNumber = cell.Row
End If
Next cell
If MyArea Is Nothing Then
MsgBox "No non-zero values found!"
Else
MyArea.Select
End If
End Sub





"Mark" wrote in message
...
Hi

I want to find the first cell that is not zero "0" across a row. I have
tried the following but is gives a syntax error. (I've searched this
forum but cannot find anything that helps me)

Cells.Find(What:<"0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate

Any help will be greatly appreciated.

Mark






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Find not equal to "0"

On Fri, 8 Jun 2007 11:37:43 +1000, "Mark" wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I have
tried the following but is gives a syntax error. (I've searched this forum
but cannot find anything that helps me)

Cells.Find(What:<"0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate

Any help will be greatly appreciated.

Mark


Do you want to limit the result to numeric values, or will anything that is not
a zero suffice? What about Blanks?

Do you want to return the value, or the cell address?

Is the non-zero value a constant? or the result of a formula?


--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Find" a wildcard as a place marker and "replace" with original va Eric Excel Discussion (Misc queries) 1 January 27th 09 06:00 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Find "Not Equal" Rick Excel Programming 0 August 5th 06 04:43 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"