jakester
Apr 11, 2011, 11:49 AM
I'm stuck with a seemingly simple line of code in VBA.
What I want to do in my spreadsheet is select Column C and all of the columns with data after it until I reach the final column of data (this is dynamic because the number of columns can vary). Then I want to offset 1 column and delete all of the columns I have selected.
For example, let's say that I have columns going up to M with M being the last column. I want to select Column C and through L then, leaving Column M alone. The last column of my data set is a Grand Total column and I will always need it... all of the data in between I don't need so I want to just delete it.
I tried something like Range("C:C", Selection.End(xlRight)).Select just to test whether it would work at all (minus the offset part) but it didn't.
Any thoughts?
What I want to do in my spreadsheet is select Column C and all of the columns with data after it until I reach the final column of data (this is dynamic because the number of columns can vary). Then I want to offset 1 column and delete all of the columns I have selected.
For example, let's say that I have columns going up to M with M being the last column. I want to select Column C and through L then, leaving Column M alone. The last column of my data set is a Grand Total column and I will always need it... all of the data in between I don't need so I want to just delete it.
I tried something like Range("C:C", Selection.End(xlRight)).Select just to test whether it would work at all (minus the offset part) but it didn't.
Any thoughts?