Forum Discussion

kdliske's avatar
kdliske
Copper Contributor
Mar 04, 2025
Solved

Need help tweaking VBA code so I can add more columns to spreadsheet

Hi, I have a macro with code that allows me to press a button that then moves rows with a certain status to another worksheet. I need to add two more columns to the worksheets, but when I do the macr...
  • HansVogelaar's avatar
    Mar 05, 2025

    The code looks for the value "Completed" in column I.

    If you insert one or more columns to the left of column I, the status will end up in another column, so you'll have to adjust the code. For example, if status is now in column K, change the line

        Set xRg = Worksheets("Tasks").Range("I3:I" & I)

    to

        Set xRg = Worksheets("Tasks").Range("K3:K" & I)

    If that is not correct, please provide more detailed information.

Resources