View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Macro to insert and move columns

I simplified the macro. I comment out the old code and show the new code
below the comments

'Columns("C:L").Select
'Range("C2").Activate
'Selection.Insert Shift:=xlToRight
Columns("C").Insert

'Columns("M:M").Select
'Range("M2").Activate
'Selection.Cut
Columns("M:M").Cut

'Columns("C:C").Select
'Range("C2").Activate
'Selection.Insert Shift:=xlToRight
Columns("C:C").insert Shift:=xlToRight

'Columns("AH:AH").Select
'Range("AH2").Activate
'Selection.Cut
Columns("AH:AH").Cut

'Columns("D:D").Select
'Range("D2").Activate
'Selection.Insert Shift:=xlToRight
Columns("D:D").insert Shift:=xlToRight

"andrea" wrote:

Hi
Hopefully you can help please...

I need to compare Budget v Actuals. Currently the spreadsheet appears
similar to below:
Budget Actual
Region A Region B Region C Region A Region B Region C
ie Regions are grouped under Budget and Actual
What I require is...
Region A Bud Region A Act Variance Region B Bud Region B Act
Varianc etc

I have recorded a very basic macro that cuts and inserts columns. It does
not have the variance column included at the moment. There has to be a
better way!!

Columns("C:L").Select
Range("C2").Activate
Selection.Insert Shift:=xlToRight
Columns("M:M").Select
Range("M2").Activate
Selection.Cut
Columns("C:C").Select
Range("C2").Activate
Selection.Insert Shift:=xlToRight
Columns("AH:AH").Select
Range("AH2").Activate
Selection.Cut
Columns("D:D").Select
Range("D2").Activate
Selection.Insert Shift:=xlToRight


Thanks in advance
Andrea