Insert Column to the left in a list

S

Shane

I am using lists to help with my data, and I want to be able to add a
new column when the month starts. So I want to add a column in the
list to the left of my total column. When I record my steps with the
Macro recorder it gives me this.

Selection.ListObject.ListColumns.Add (28) which always puts a new
column at the 28 position.

the other code of

ActiveCell.Offset(0, 1).EntireColumn.Insert

doesn't work with lists. I have named the range of the total row to
Total12 (because I am summing the most recent 12 months). Thanks for
your help.

Shane
 
J

JLGWhiz

Range("Total12").EntireColumn.Insert

Should insert new column and move the Total12 to the right.
 
S

Shane

I am using lists to help with my data, and I want to be able to add a
new column when the month starts. So I want to add a column in the
list to the left of my total column. When I record my steps with the
Macro recorder it gives me this.

Selection.ListObject.ListColumns.Add (28) which always puts a new
column at the 28 position.

the other code of

ActiveCell.Offset(0, 1).EntireColumn.Insert

doesn't work with lists. I have named the range of the total row to
Total12 (because I am summing the most recent 12 months). Thanks for
your help.

Shane

Nevermind. I figured it out.

Thanks anyway
 
D

Don Guillett

Assumes a header row in row 1

Sub addcolumnbeforelastcolumn()
Columns(Cells(1, Columns.Count).End(xlToLeft).Column).Insert
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top