S
Sue
Help! This code is meant to insert 2 columns to the right, copy the last two
used columns and place their formulae in the new columns. It has been
recorded with actions which do just that, but this macro does not work. It
works to the * but at that point selects all the columns in the work sheet
not just the last 2. This is a disaster and I can not seem to stop it doing
that. I suspect the line two below would have the same issue.
Range("a2").Select 'data headings in this row
Selection.End(xlToRight).Select 'gets to end column via data headings
ActiveCell.Offset(0, 1).Range("a1:b1").Select 'selection of 2 columns at
end
Selection.EntireColumn.Insert 'puts new columns in
* ActiveCell.Offset(0, -2).Columns("A:B").EntireColumn.Select 'stuffs up
here!
Selection.Copy
ActiveCell.Offset(0, 2).Columns("A:B").EntireColumn.Select
Selection.PasteSpecial Paste:=xlFormulas
Application.CutCopyMode = False
Calculate
used columns and place their formulae in the new columns. It has been
recorded with actions which do just that, but this macro does not work. It
works to the * but at that point selects all the columns in the work sheet
not just the last 2. This is a disaster and I can not seem to stop it doing
that. I suspect the line two below would have the same issue.
Range("a2").Select 'data headings in this row
Selection.End(xlToRight).Select 'gets to end column via data headings
ActiveCell.Offset(0, 1).Range("a1:b1").Select 'selection of 2 columns at
end
Selection.EntireColumn.Insert 'puts new columns in
* ActiveCell.Offset(0, -2).Columns("A:B").EntireColumn.Select 'stuffs up
here!
Selection.Copy
ActiveCell.Offset(0, 2).Columns("A:B").EntireColumn.Select
Selection.PasteSpecial Paste:=xlFormulas
Application.CutCopyMode = False
Calculate