Thomas Kuriakose
Active Member
Respected Sirs,
We have a workbook, with the requirement of insertion and deletions of three columns based on a cell value before the cells with headers Total, Max and Min.
The cell B1 = Number of sets of columns to be inserted.
Cells C:E is Group one and on activation of the macro, this should insert a copy of C:E after column E and before the column headers Total, Max and Min based on the input value in cell B1. The formulas in Total, Max and Min should be updated based on the number of sets of columns inserted.
The Group numbers should be incremented based on number of sets inserted as Group1, Group2...
If the number of columns sets to be inserted is less than the existing number of sets, then the corresponding sets of columns should get deleted and the formulas and Group numbers should be adjusted.
I found the below code, but it is inserting only one set at a time and the Groups and Formulas code is not there.
Kindly guide on how to get this working.
Thank you very much,
with regards,
thomas
We have a workbook, with the requirement of insertion and deletions of three columns based on a cell value before the cells with headers Total, Max and Min.
The cell B1 = Number of sets of columns to be inserted.
Cells C:E is Group one and on activation of the macro, this should insert a copy of C:E after column E and before the column headers Total, Max and Min based on the input value in cell B1. The formulas in Total, Max and Min should be updated based on the number of sets of columns inserted.
The Group numbers should be incremented based on number of sets inserted as Group1, Group2...
If the number of columns sets to be inserted is less than the existing number of sets, then the corresponding sets of columns should get deleted and the formulas and Group numbers should be adjusted.
I found the below code, but it is inserting only one set at a time and the Groups and Formulas code is not there.
Code:
Sub Insert_Columns()
Dim x As Long
x = Range("B1").Value
Columns("C:E").Select
Selection.Copy
Range(Cells(, 6), Cells(, 6 + x - 1)).Select
Selection.Insert shift:=xlToRight
Application.CutCopyMode = False
Application.EnableEvents = True
End Sub
Kindly guide on how to get this working.
Thank you very much,
with regards,
thomas