Replace

F

Frank Kabel

Hi
not really sure what you're trying to achieve. Could you
give an example.e.g what is your 'detail'
 
G

Guest

If I have in Column A diffrent data ex:
A1:JFK001230
A2:FRA001630
A3:Header
I want a macro to replace all the text in column A that
is not equal to "Header" with the word "Detail.
hope is is more clear
 
G

Guest

If I have in Column A diffrent data ex:
A1:JFK001230
A2:FRA001630
A3:Header
I want a macro to replace all the text in column A that
is not equal to "Header" with the word "Detail.
hope is is more clear
 
F

Frank Kabel

Hi
try the following macro:

Sub delete_rows()
Dim RowNdx As Long
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For RowNdx = LastRow To 1 Step -1
with Cells(RowNdx, "A")
if .value = "Header" then
.value = "Detail"
End If
end with
Next RowNdx
Application.ScreenUpdating = True
End Sub
 
D

Dana DeLouis

If you like to avoid loops, and your worksheet can handle it, perhaps
another option.

Sub Demo()
ActiveSheet.UsedRange
With Columns("A:A")
.Replace What:="Header", Replacement:="=#N/A", LookAt:=xlWhole,
MatchCase:=False
.SpecialCells(xlCellTypeConstants, xlTextValues).Value = "Detail"
.SpecialCells(xlCellTypeFormulas, xlErrors).Value = "Header"
End With
ActiveSheet.UsedRange
End Sub
 
Top