K
KH_GS
Hi
I have a column containing text phrases in each cell, if there's an
word in the cell ends with "abc", I want that phrase to be in a ne
column.
Data in each cell:
appleabc is not red
roadabc is long
green apple
roadblock
apple is fruitabc
sweet fruit
Output(in a new column):
appleabc is not red
roadabc is long
apple is fruitabc
Here's the code that doesn't work
Sub PrintEnd_ING()
Dim Cell As Range
Dim myString As String
Application.DisplayAlerts = False
Application.ScreenUpdating = False
x = ActiveCell.Row
y = ActiveCell.Column
For Each Cell In Range(Selection, Selection.End(xlDown))
myString = Cells(x, y).Value
If myString Like "*abc" Or myString = "*abc? " Then
ActiveSheet.Cells(x, y + 3).Value = myString
ActiveSheet.Cells(x, y + 4).Value = Cell.Offset(0, 1).Value
x = x + 1
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Su
I have a column containing text phrases in each cell, if there's an
word in the cell ends with "abc", I want that phrase to be in a ne
column.
Data in each cell:
appleabc is not red
roadabc is long
green apple
roadblock
apple is fruitabc
sweet fruit
Output(in a new column):
appleabc is not red
roadabc is long
apple is fruitabc
Here's the code that doesn't work
Sub PrintEnd_ING()
Dim Cell As Range
Dim myString As String
Application.DisplayAlerts = False
Application.ScreenUpdating = False
x = ActiveCell.Row
y = ActiveCell.Column
For Each Cell In Range(Selection, Selection.End(xlDown))
myString = Cells(x, y).Value
If myString Like "*abc" Or myString = "*abc? " Then
ActiveSheet.Cells(x, y + 3).Value = myString
ActiveSheet.Cells(x, y + 4).Value = Cell.Offset(0, 1).Value
x = x + 1
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Su