IF statements using VBA code

  • I am trying to write vba code for data that will not always be in the same cells in the workbooks, however the cell that I want will always have "avg" in Column A. I want to code something along the lines of If range("A1:A50") = avg then copy E:(corresponding row to "avg").
    Is this possible? If not, how else could I code my macro to select the cell I want?

  • Hi,

    Why don't you attach a sample workbook ... to make things a lot easier ...:wink:

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • [USER="31712"]Carim[/USER] is this okay? To reiterate, I am trying to select the cell in column E that corresponds to the row that "Avg" is in Column A. I think IF statements or lookup would be my best route but I am not skilled enough in VBA to know the code for it. Thanks!

  • [USER="31712"]Carim[/USER] Hello, thank you for taking your time to help me :) from the code you provided, how would I then select and copy that cell with vba? I need to automate the copy/paste process. This is what I have for my macro rn.

    The problem with this is that it wont select the cell I want it to. Also, when it copies into my table, it takes up every singe cell, where as I just want it to take up one of them. Specifically Cell(2,4).

  • Okay this works. Now I just need to paste it into the correct part of the bookmarked table. It copies into every cell of it where I would like it to just copy into Cell (3,4) of the table

  • Some more development..

    This is what I was looking to do. Is there a way to code it so that if the bookmark already has text in it, then it will paste below it, and so on?

  • Hello Klutch

    Try this....

    Good Luck

Participate now!

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