I have code for copy - pasting range after existing columns. There is a need to be able to baste it also between existing columns. So it will paste copied range to the right next after selected cell. The problem here is that there is no possibility to add more columns by using "Insert". So existing data should be somehow moved to the right. By copy - paste? Is it the only solution and how it can be done technically?
So if I select merged cells H:I and hit ADD, code will move J:K and L:M to the right and paste copied range to the place where J:K has been recently.
My current code for ADD button is:
Sub CopyPasteTurbineOwnWork()
Application.ScreenUpdating = False
Dim StartRange As Range
Dim cello As Range
Set cello = Worksheets("Price calculation").Cells(13, Columns.Count)
Set StartRange = Worksheets("Price calculation").Range("D13")
StartRange.MergeArea.Copy
cello.End(xlToLeft).Offset(0, 1).PasteSpecial xlPasteAll
StartRange.Offset(1, 0).Resize(16, 2).Copy
cello.End(xlToLeft).Offset(1, 0).PasteSpecial xlPasteAll
StartRange.Offset(17, 0).MergeArea.Copy
cello.End(xlToLeft).Offset(17, 0).PasteSpecial xlPasteAll
StartRange.Offset(18, 0).Resize(2, 2).Copy
cello.End(xlToLeft).Offset(18, 0).PasteSpecial xlPasteAll
StartRange.Offset(148, 0).MergeArea.Copy
cello.End(xlToLeft).Offset(148, 0).PasteSpecial xlPasteAll
StartRange.Offset(149, 0).Resize(5, 2).Copy
cello.End(xlToLeft).Offset(149, 0).PasteSpecial xlPasteAll
Set StartRange = Nothing
Set pasteSheet = Nothing
Set cello = Nothing
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Range("I:I").EntireColumn.insert Shift:=xlToRight
works just fine. If you're pasting multiple columnsRange("H:I").EntireColumn.insert Shift:=xlToRight
with a pre-defined range would do it. – Plutian