I am working on a code that adds 2 columns to the right of the specified header column as below - the below code works but I need to have the value for the first new column reflect "STATE MW" and the header for the second reflect "MW * REG HRS". Can someone please help
Sub InsertTwoColumnsRightOfStateCD1()
Dim ws As Worksheet
Dim stateCDColumn As Range
' Set the worksheet
Set ws = ThisWorkbook.Sheets("CSV Earnings Statement Register")
' Find the "STATE CD 1" column
Set stateCDColumn = ws.Rows(1).Find(What:="STATE CD 1", LookIn:=xlValues, LookAt:=xlWhole)
' If the column is found, insert two columns to the right
If Not stateCDColumn Is Nothing Then
stateCDColumn.Offset(0, 1).Resize(1, 2).EntireColumn.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
MsgBox "Two columns inserted to the right of STATE CD 1."
Else
MsgBox "STATE CD 1 column not found!"
End If
End Sub
Sub InsertTwoColumnsRightOfStateCD1()
Dim ws As Worksheet
Dim stateCDColumn As Range
' Set the worksheet
Set ws = ThisWorkbook.Sheets("CSV Earnings Statement Register")
' Find the "STATE CD 1" column
Set stateCDColumn = ws.Rows(1).Find(What:="STATE CD 1", LookIn:=xlValues, LookAt:=xlWhole)
' If the column is found, insert two columns to the right
If Not stateCDColumn Is Nothing Then
stateCDColumn.Offset(0, 1).Resize(1, 2).EntireColumn.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
MsgBox "Two columns inserted to the right of STATE CD 1."
Else
MsgBox "STATE CD 1 column not found!"
End If
End Sub