View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Isis[_2_] Isis[_2_] is offline
external usenet poster
 
Posts: 51
Default Conditionally copy cell from one column to another VBA

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