This code below adds a column next to the search term in the header on the right. How do I change this to add a column on the left?
Will there be a good soul here that will help me solve the mystery?
At the beginning
Current status
Expected result
Will there be a good soul here that will help me solve the mystery?
At the beginning
Auto | By foot |
Auto | Bike | By foot |
Bike | Auto | By foot |
VBA Code:
Sub AddRows()
Sheets("Sheet1").Select
Dim rngUsernameHeader As Range
Dim rngHeaders As Range
Set rngHeaders = Range("1:1") 'Looks in entire first row.
Set rngUsernameHeader = rngHeaders.Find(what:="Auto", After:=Cells(1, 1))
rngUsernameHeader.Offset(0, 1).EntireColumn.Insert
rngUsernameHeader.Offset(0, 1).Value = "Bike"
End Sub