Hello everyone:
I know this is an easy one, but is late in the day and I can't think anymore, plus I am a rookie at VBA. I am trying to replace the header in column I1 with the title Exemption. But I am erroing out. The code is part of a larger code, so I only posted the part that is giving the problem. The part in red is where the problem is.
Private Sub CommandButton1_Click()
'Prepare exports
'Delete cells and find and replace Y
'delete columns that are not referenced
Dim k As Long, I As Long, ws As Worksheet
With Sheets("byposition")
.Range("E:E").Copy .Range("A1")
.Columns("I:I").Replace What:="$", Replacement:="N", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
.Columns("I:I").Replace What:="", Replacement:="Y", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
.Range("I1").Select
ActiveCell.FormulaR1C1 = "Exemption"
End With
I know this is an easy one, but is late in the day and I can't think anymore, plus I am a rookie at VBA. I am trying to replace the header in column I1 with the title Exemption. But I am erroing out. The code is part of a larger code, so I only posted the part that is giving the problem. The part in red is where the problem is.
Private Sub CommandButton1_Click()
'Prepare exports
'Delete cells and find and replace Y
'delete columns that are not referenced
Dim k As Long, I As Long, ws As Worksheet
With Sheets("byposition")
.Range("E:E").Copy .Range("A1")
.Columns("I:I").Replace What:="$", Replacement:="N", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
.Columns("I:I").Replace What:="", Replacement:="Y", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
.Range("I1").Select
ActiveCell.FormulaR1C1 = "Exemption"
End With