Hi All,
I have to arrange the data in the below column form, I am using the below code but when we add column all structure got mess up. Please see the attached file.
1 2 3 4
Mod Edit: Code tags added
I have to arrange the data in the below column form, I am using the below code but when we add column all structure got mess up. Please see the attached file.
1 2 3 4
Code:
ival2 = Sheet2.Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To ival2 Step 1
IF Cells(4, i).Value <> "4" Then
Columns(i).Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Application.ScreenUpdating = False
Cells(4, i).Value = "4"
End If
Next
IF Cells(4, i).Value <> "3" Then
Columns(i).Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Application.ScreenUpdating = False
Cells(4, i).Value = "3"
End If
Next
END SUB
Mod Edit: Code tags added
Attachments
Last edited by a moderator: