pretzman21
New Member
- Joined
- Aug 7, 2018
- Messages
- 11
I would like to use an excel VBA to in this case remove an "a" from a group of cells, and move one of them to a new cell. In the formula below, it has added the "a" to K48 and removed the a's from L48:N48. I would like to to search a range, for me it is L2:N100. The "a" needs to be removed from any grouping and placed in that corresponding K cell. It needs to be able to do this any amount of times. Can this formula be adjusted to do this, or a new formula perhaps? Any help is appreciated. Thank you.
Sub MoveAValue()
Range("L48:N48").Select
Selection.Replace What:="a", Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Range("K48").Select
ActiveCell.FormulaR1C1 = "a"
Range("K49").Select
End Sub
Sub MoveAValue()
Range("L48:N48").Select
Selection.Replace What:="a", Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Range("K48").Select
ActiveCell.FormulaR1C1 = "a"
Range("K49").Select
End Sub