Conditional Copy and Paste cells

  • Hello


    I'm am relatively new to creating VBA macros and would appreciate some help to get the following task.


    I have a spread sheet with about 7 columns of data in column A-G and over 30,000 rows of data. My prolblem is I can't have any negative numbers in columns E,F or G. I'm trying to get a macro to go down each row in columns E, F and G and evaluate the data if the number is negative I want to copy it to column A and put a zero in it place instead of the the negative number.


    I've tried several If condition and copy(Destination) scenarios but none has worked so far.


    Please help.

  • Re: Conditional Copy and Paste cells


    do you have a xls file you can attach to see what it is doing exactly.


    From what I can tell you will need to programme a loop to look at each row and read the values from each cell of the 3 columns into variables. Check that they >=0 and if not set the cell value to "" and the cell A(rownumber) to the value of the -figure.

  • Re: Conditional Copy and Paste cells


    Sorrry, no good with VBA but,


    I know you can do a conditional formatting and place a formula to change the negative values to 0. If someone could me out with the formula I would appreciate it also.


    Another alternative would be to create new columns with a "if" calculations like =if(a1<0,0,a1) with column a having your data and col b using the formula.


    I dont know if this helps you any.

    [SIZE=2]I should change my name to STUMBED![/SIZE]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!