Forum Discussion
Need help tweaking VBA code so I can add more columns to spreadsheet
- 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.
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.
- kdliskeMar 05, 2025Copper Contributor
Thank-you, that worked perfectly. Now I'm running into another issue. I am trying to re-use an old spreadsheet for a new purpose and the code is remembering the old table range (ex. so rather than re-starting by moving the 'Completed' row to the first empty line (row 3), it is moving it to row 2574). How would I re-set that?