reflectingg0d
New Member
- Joined
- Mar 16, 2011
- Messages
- 3
Hello,
I'm pretty new at this, in fact I rely on recording various actions to get the code I need then piece them all together, but that's not helping me in this case.
I'm looking for a way to search for a word in column E. Once it is found, moving it to column A on the same row, then merging the cells in A:E on that row.
Sub Macro2()
'
' Macro2 Macro
'
'searching for the word andromeda
Cells.Find(What:="Andromeda", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Range("E851").Select
Selection.AutoFill Destination:=Range("A851:E851"), Type:=xlFillDefault
Range("A851:E851").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
End Sub
That's what I recorded, autofill through column A gave the same result once the cells were merged, but the problem is that data isn't always going to be in row 851. How do I get it to select the cell that data is in, and fill the cells to the left when it's in a different row every time?
Your help is greatly appreciated!
I'm pretty new at this, in fact I rely on recording various actions to get the code I need then piece them all together, but that's not helping me in this case.
I'm looking for a way to search for a word in column E. Once it is found, moving it to column A on the same row, then merging the cells in A:E on that row.
Sub Macro2()
'
' Macro2 Macro
'
'searching for the word andromeda
Cells.Find(What:="Andromeda", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Range("E851").Select
Selection.AutoFill Destination:=Range("A851:E851"), Type:=xlFillDefault
Range("A851:E851").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
End Sub
That's what I recorded, autofill through column A gave the same result once the cells were merged, but the problem is that data isn't always going to be in row 851. How do I get it to select the cell that data is in, and fill the cells to the left when it's in a different row every time?
Your help is greatly appreciated!