Is it possible to.........

  • Thread starter Thread starter Pat
  • Start date Start date
P

Pat

Is it possible to return a cell to zero after it displays a minus number
result in a cell. ?

The minus result is the result of code being run and it can result in more
than one cell in a range eg A1:A10

I do not want a formula to be used.

Any pointers on this will be most appreciated.
Pat
 
I for one do not understand.

What exactly do you mean by '... after it displays a minus number result in
a cell...' and '... minus result is the result of code being run and it can
result in more than one cell in a range eg A1:A10...'?


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Hi Bob,

Ok, say for example:
A1 = -6
A4 = -21
A10 = -8

The above are the result of a calculation preformed with use of code. Once
the code completes I need some other way of returning A1, A4 & A10 to 0

I could custom filter column A to display any cells with a negative value
then just manually enter 0.
However I prefer to use another way, if that is possible.

Pat
 
One way would be to write a macro to find all the negative entries and
replace them with 0. Another way is for you to select the range that
contains your numbers, negative ones as well as positive ones. Then do
Edit - Replace. Put "-*" without the quotes for the Find, and put "0"
without the quotes for the Replace With:. Post back if this doesn't work
for you. HTH Otto
 
Hi Pat,

Could you just run this macro at the end of your code?

Sub ClearNegatives()
Dim iLastRow As Long
Dim i As Long
iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
If IsNumeric(Cells(i,"A").Value) Then
If Cells(i,"A").Value < 0
Cells(i,"A").Value = 0
End If
End If
Next i
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Similar Threads

Excel Need Countifs Formula Help 0
Deleting blank cells globally 8
make a minus a zero 2
Return a cell reference as a result of an IF formula 1
changing signs in formulas and cells 1
Excel VBA 1
Replace the minus value 3
-sign 2

Back
Top