Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to loop through a column row by row, (at least I think I need to
loop ?)and then conditionally copy the value of that cell to a different column (but the same row) after a mathmatical operation (times -1, or plus ..3 etc) on the value. How would I do that ? Can I adapt it so that the column can be 'set' when running ? Thanks for any input |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jan 23, 7:39*am, Isis wrote:
I want to loop through a column row by row, (at least I think I need to loop ?)and then conditionally copy the value of that cell to a different column (but the same row) after a mathmatical operation (times -1, or plus .3 etc) on the value. How would I do that ? Can I adapt it so that the column can be 'set' when running ? Thanks for any input Hard to tell without seeing as your explanation is lacking "If desired, send your file to dguillett @gmail.com I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results." |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Don Guillett Excel MVP wrote in
: On Jan 23, 7:39*am, Isis wrote: I want to loop through a column row by row, (at least I think I need to loop ?)and then conditionally copy the value of that cell to a different column (but the same row) after a mathmatical operation (times -1, or plu s .3 etc) on the value. How would I do that ? Can I adapt it so that the column can be 'set' when running ? Thanks for any input Hard to tell without seeing as your explanation is lacking "If desired, send your file to dguillett @gmail.com I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results." Thanks for the reply Don. What I want to do is something like this; Col1 Col2 1 2 3 4 Sheet as above - I want to run some code and end up with; Col1 Col2 1 Untouched -2 x * -1 -3 x * -1 4 Untouched I dont mind too much if the values are also left in the first column but I want the results placed in the empty cells of Col2. Imagine, if you would - I have a load of sheets of data that contain 3 columns - 'payments IN' , 'payments Out' and a 'Balance' column. All the figures in 'payments In' and 'payments Out' are positive decimal amounts - I want to end up with just 2 columns, one containing positive decimals from 'payments IN' and also negative decimals from 'payments Out' and a 'Balance' column where I will show a running balance. Hope this makes sense; So in pseudo code; Loop i# = B1 to B? 'Loop through every filled B cell If cell.Value 'If the is a value in this cell Ci# = (cell.Value * -1) 'Copy over to C Column (same Row) - negative End If End Loop Hope that makes sense Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's a manual procedure that you can quickly apply. If you turn the
macro recorder on while you do it, then you will have the basis of a macro for next time you need to apply it. Apply Autofilter to column 2. From the filter drop-down select Blanks. In the top-most visible cell in column 2 begin to enter the formula: =- then click on the cell in column 1 on the same row. Then you can copy this formula down to cover the amount of data in the visible cells. Then you can select All in the filter, and finally copy column B and Paste Special | Values to fix the values. Hope this helps. Pete On Jan 23, 6:13*pm, Isis wrote: Don Guillett Excel MVP wrote : On Jan 23, 7:39*am, Isis wrote: I want to loop through a column row by row, (at least I think I need to loop ?)and then conditionally copy the value of that cell to a different column (but the same row) after a mathmatical operation (times -1, or plu s .3 etc) on the value. How would I do that ? Can I adapt it so that the column can be 'set' when running ? Thanks for any input Hard to tell without seeing as your explanation is lacking "If desired, send your file to dguillett I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results." Thanks for the reply Don. What I want to do is something like this; Col1 *Col2 * * * * * * * 1 2 3 * * * * 4 Sheet as above - I want to run some code and end up with; Col1 *Col2 * * * * * * * 1 * * * * Untouched * * * * -2 * * * *x * -1 * * * * -3 * * * *x * -1 * * * * 4 * * * * Untouched I dont mind too much if the values are also left in the first column but I want the results placed in the empty cells of Col2. Imagine, if you would - I have a load of sheets of data that contain 3 columns - 'payments IN' , 'payments Out' and a 'Balance' column. All the figures in 'payments In' and 'payments Out' are positive decimal amounts - I want to end up with just 2 columns, one containing positive decimals from 'payments IN' and also negative decimals from 'payments Out' and a 'Balance' column where I will show a running balance. Hope this makes sense; So in pseudo code; Loop i# = B1 to B? * * * * * 'Loop through every filled B cell If cell.Value * * * * * * * *'If the is a value in this cell * Ci# = (cell.Value * -1) * *'Copy over to C Column (same Row) - negative End If End Loop Hope that makes sense Thanks *- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
summing across worksheets conditionally and being able to copy for | Excel Discussion (Misc queries) | |||
How do I conditionally format a row and copy the formatting to tab | Excel Worksheet Functions | |||
How can I have Excel conditionally copy a cell | Excel Worksheet Functions | |||
Copy text cell & change text color conditionally | Excel Programming | |||
copy rows conditionally | Excel Programming |