Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Locate negative number

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
--
Burt
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Locate negative number

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

"BurtArkin" wrote:

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
--
Burt

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Locate negative number

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.
--
Burt


"Mike H" wrote:

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

"BurtArkin" wrote:

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
--
Burt

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
Converting Negative Number to Postive number Tedd Excel Worksheet Functions 7 September 2nd 09 04:34 PM
Converting a negative number to a positive number Barb Excel Discussion (Misc queries) 3 November 1st 07 02:20 AM
negative number to positive number Mike Casey Excel Discussion (Misc queries) 2 April 26th 06 05:43 PM
Locate first number that exceeds reference value Nick Krill Excel Worksheet Functions 2 January 6th 06 03:33 AM
2003= negative number&2004= negative number How Do I Calculate gro Jason Excel Worksheet Functions 1 January 14th 05 05:24 PM


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

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"