Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
enter opposite number one row below
Can someone help me on this.
lets say i have column O row 1 150 row 2 row 3 92 row 4 row 5 70 row 6 how can i create a macro that goes to column O, enters the value of the cell above in this case 150, one row below having opposite sign -150, insert a row below, and continue the same procedure. In this case, making 92 as -92 one row below and insert a new row, and so on. Thanks a lot. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
enter opposite number one row below
change ,1 to ,"o"
Sub putnumbers() For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1 If Cells(i, 1) 0 Then Cells(i + 1, 1) = -Cells(i, 1) Next i End Sub -- Don Guillett SalesAid Software "andresg1975" wrote in message ... Can someone help me on this. lets say i have column O row 1 150 row 2 row 3 92 row 4 row 5 70 row 6 how can i create a macro that goes to column O, enters the value of the cell above in this case 150, one row below having opposite sign -150, insert a row below, and continue the same procedure. In this case, making 92 as -92 one row below and insert a new row, and so on. Thanks a lot. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
enter opposite number one row below
I didn't explain myself clear
the macro is only taking positive signs and converting them to minus signs. It should be a macro converting positive to minus, and minus to positives. thanks again. at the end it shoul be like this 150 -150 -400 400 -250 250 150 change to -150, insert a row -400 change to 400, insert a row "Don Guillett" wrote: change ,1 to ,"o" Sub putnumbers() For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1 If Cells(i, 1) 0 Then Cells(i + 1, 1) = -Cells(i, 1) Next i End Sub -- Don Guillett SalesAid Software "andresg1975" wrote in message ... Can someone help me on this. lets say i have column O row 1 150 row 2 row 3 92 row 4 row 5 70 row 6 how can i create a macro that goes to column O, enters the value of the cell above in this case 150, one row below having opposite sign -150, insert a row below, and continue the same procedure. In this case, making 92 as -92 one row below and insert a new row, and so on. Thanks a lot. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
enter opposite number one row below
can u tell me which 1 should i change to replace for my column I
thanks "Don Guillett" wrote: try this. Notice the step -2 Sub putnumbers() For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -2 Cells(i + 1, 1) = -Cells(i, 1) Next End Sub -- Don Guillett SalesAid Software "andresg1975" wrote in message ... I didn't explain myself clear the macro is only taking positive signs and converting them to minus signs. It should be a macro converting positive to minus, and minus to positives. thanks again. at the end it shoul be like this 150 -150 -400 400 -250 250 150 change to -150, insert a row -400 change to 400, insert a row "Don Guillett" wrote: change ,1 to ,"o" Sub putnumbers() For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1 If Cells(i, 1) 0 Then Cells(i + 1, 1) = -Cells(i, 1) Next i End Sub -- Don Guillett SalesAid Software "andresg1975" wrote in message ... Can someone help me on this. lets say i have column O row 1 150 row 2 row 3 92 row 4 row 5 70 row 6 how can i create a macro that goes to column O, enters the value of the cell above in this case 150, one row below having opposite sign -150, insert a row below, and continue the same procedure. In this case, making 92 as -92 one row below and insert a new row, and so on. Thanks a lot. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
enter opposite number one row below
I thought I had done that ,1 ,"o"
Sub putnumbers() For i = Cells(Rows.Count, "o").End(xlUp).Row To 1 Step -2 Cells(i + 1, "o") = -Cells(i, "o") Next End Sub -- Don Guillett SalesAid Software "andresg1975" wrote in message ... can u tell me which 1 should i change to replace for my column I thanks "Don Guillett" wrote: try this. Notice the step -2 Sub putnumbers() For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -2 Cells(i + 1, 1) = -Cells(i, 1) Next End Sub -- Don Guillett SalesAid Software "andresg1975" wrote in message ... I didn't explain myself clear the macro is only taking positive signs and converting them to minus signs. It should be a macro converting positive to minus, and minus to positives. thanks again. at the end it shoul be like this 150 -150 -400 400 -250 250 150 change to -150, insert a row -400 change to 400, insert a row "Don Guillett" wrote: change ,1 to ,"o" Sub putnumbers() For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1 If Cells(i, 1) 0 Then Cells(i + 1, 1) = -Cells(i, 1) Next i End Sub -- Don Guillett SalesAid Software "andresg1975" wrote in message ... Can someone help me on this. lets say i have column O row 1 150 row 2 row 3 92 row 4 row 5 70 row 6 how can i create a macro that goes to column O, enters the value of the cell above in this case 150, one row below having opposite sign -150, insert a row below, and continue the same procedure. In this case, making 92 as -92 one row below and insert a new row, and so on. Thanks a lot. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
enter opposite number one row below
You need to find a column with continuous data to the last row and use that
on the For line: Sub putnumbers() For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -2 On this line you use the column number for the one you want to add the opposite value. Change the "1" after the comma to the corresponding number for A=1, B=2, C=3, etc. Cells(i + 1, 1) = -Cells(i, 1) Next End Sub Does this answer your question? "andresg1975" wrote: can u tell me which 1 should i change to replace for my column I thanks "Don Guillett" wrote: try this. Notice the step -2 Sub putnumbers() For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -2 Cells(i + 1, 1) = -Cells(i, 1) Next End Sub -- Don Guillett SalesAid Software "andresg1975" wrote in message ... I didn't explain myself clear the macro is only taking positive signs and converting them to minus signs. It should be a macro converting positive to minus, and minus to positives. thanks again. at the end it shoul be like this 150 -150 -400 400 -250 250 150 change to -150, insert a row -400 change to 400, insert a row "Don Guillett" wrote: change ,1 to ,"o" Sub putnumbers() For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1 If Cells(i, 1) 0 Then Cells(i + 1, 1) = -Cells(i, 1) Next i End Sub -- Don Guillett SalesAid Software "andresg1975" wrote in message ... Can someone help me on this. lets say i have column O row 1 150 row 2 row 3 92 row 4 row 5 70 row 6 how can i create a macro that goes to column O, enters the value of the cell above in this case 150, one row below having opposite sign -150, insert a row below, and continue the same procedure. In this case, making 92 as -92 one row below and insert a new row, and so on. Thanks a lot. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
enter a number if equal to another number | Excel Discussion (Misc queries) | |||
Why am I getting ### when I enter an accting number and hit enter | New Users to Excel | |||
when I enter a number, only ###### shows? | Excel Worksheet Functions | |||
Always enter number as a decimal <1 | Excel Discussion (Misc queries) | |||
enter 2 values in opposite corners of a cell | Excel Discussion (Misc queries) |