Change value of two cells based on one cell VBA

  • Hi All,


    I am trying to write a code that will change the value in Column I if Column K has value "Orange" to "Fruit". But I also want the value of the next cell down in Column I change to "Fruit" as well.
    My macro below only works when I have one singular value change but not multiple. Could you please help?
    For example: desired result is if Column K3 = "Orange" then Column I3 & I4 = "Fruit". I have about 300 lines of data to go through. Thank you for your help!!!!


  • Re: Change value of two cells based on one cell VBA


    codepro


    You have posted enough times on this forum to know that code must be wrapped in code tags. Also do not format anything in the code to a different font colour or make any font bold (including code comments).


    Please edit your post to do the above, thank you.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Change value of two cells based on one cell VBA


    Hi All,


    I am trying to write a code that will change the value in Column I if Column K has value "Orange" to "Fruit". But I also want the value of the next cell down in Column I change to "Fruit" as well.
    My macro below only works when I have one singular value change but not multiple. Could you please help?
    For example: desired result is if Column K3 = "Orange" then Column I3 & I4 = "Fruit". I have about 300 lines of data to go through. Thank you for your help!!!!


  • Re: Change value of two cells based on one cell VBA


    Quote from KjBox;784485

    codepro


    You have posted enough times on this forum to know that code must be wrapped in code tags. Also do not format anything in the code to a different font colour or make any font bold (including code comments).


    Please edit your post to do the above, thank you.


    how do I do that? how do I put quotation marks?

  • Re: Change value of two cells based on one cell VBA


    First remove the colour and bold text from the code you pasted and the quotation marks, then highlight all the code and click the # icon in the menu bar at the top of the Reply window.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Change value of two cells based on one cell VBA


  • Re: Change value of two cells based on one cell VBA


    Quote from KjBox;784512

    First remove the colour and bold text from the code you pasted and the quotation marks, then highlight all the code and click the # icon in the menu bar at the top of the Reply window.


    thank you for your help! but couldn't remove the green color from the code. I tried multiple times and I couldn't remove it. Thank you!

  • Re: Change value of two cells based on one cell VBA


    I have done the editing for you on this occasion. Please ensure you use code tags properly in the future.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Change value of two cells based on one cell VBA


    "And" is incorrect.
    Delete this word and place the code following it on the next line

Participate now!

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