Hi All
I have a spreadsheet with a header row that goes – “time, Area, time, Area” etc. All I want to do is insert a column to the right of each cell that contains “Area”. My code sucessfully cycles through all the cells in the row that have “Time” or “Area” but does not ever insert a column. I have gone so far as to display the cell.value using msgbox and the code is correctly reading the cell contents but for some reason the If…Then… statement is never satisfied.
It must be something simple but I have tried a half dozen variations and have had no success. Any ideas for a rookie?
Thanks
Sub Insertcolumn()
‘use to insert column after “Area” cells
Range(“E3”).Activate
Do While Not IsEmpty(ActiveCell)
If ActiveCell.Value = “Area” Then
ActiveCell.EntireColumn.Offset(0, 1).Insert (xlShiftToRight)
ActiveCell.Offset(0, 2).Select ‘move activecell over 2 columns
End If
ActiveCell.Offset(0, 1).Select ‘move activecell over 1 column
Loop
End Sub