AutoFill from previous column

satkin2

New Member
Joined
Oct 22, 2009
Messages
25
Hi,
I have a spreadsheet that adds a new column each month and I want to set up a macro to take the last column and AutoFill one column to the right when run.

Example:
This month I've got column AS populated with heading 01/09/11, I want to AutoFill AT with the heading 01/10/11, next month I want to AutoFill AU with the heading 01/11/11 from AT etc;

I've got my code adding the new column as needed, but I want not got the heading autofilling accross
Code:
Sub Macro10()
  Sheets("format").Select
  Range("A1").Select
  Selection.End(xlToRight).Offset(0, 1).EntireColumn.Select
  Selection.Insert Shift:=xlToLeft#
End Sub

NB: These columns aren't the last ones in the spreadsheet.
 
That's great, only problem is it is taking away the blank column, rather than shoving it to the right.
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Add this after the first line of code.
Code:
 LastCol.Offset(, 1).EntireColumn.Insert xlShiftToRight
 
Upvote 0

Forum statistics

Threads
1,224,567
Messages
6,179,571
Members
452,927
Latest member
whitfieldcraig

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top