Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Is it possible to.........
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 |
#2
|
|||
|
|||
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) "Pat" wrote in message ... 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 |
#3
|
|||
|
|||
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 "Bob Phillips" wrote in message ... 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) "Pat" wrote in message ... 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 |
#4
|
|||
|
|||
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 "Pat" wrote in message ... 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 "Bob Phillips" wrote in message ... 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) "Pat" wrote in message ... 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 |
#5
|
|||
|
|||
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) "Pat" wrote in message ... 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 "Bob Phillips" wrote in message ... 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) "Pat" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|