I have two columns in which I am comparing the text for both of them. Column A contains text 'Hello 2005 A LW Allocate' and the column B has text 'A LW' . I want to split the text in column A such that column C should have 'Hello 2005 Allocate' and D should have 'A LW'. The value in column B can be among a specific list of values {A, A LW, I , J} etc and I want to match the same text to that of column A and split it. I would really appreciate if someone can help. Right now, I have a code which looks something like this:
`Sub Testing()
Dim DataRange As Range, CheckRange As Range, aCell As Range, bCell As Range
Dim rightStrng As String
Dim i As Long
Set ws = Worksheets("Sheet 1")
Set CheckRange = ws.Range("C2,C35000") - Column which has data
Set DataRange = ws.Range("F2,F34") - Column to which I am comparing data
With Worksheets("Sheet 1")
For Each aCell In CheckRange.Rows
Set bCell = DataRange.Find(What:=aCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
Set strng = Split(bCell)
Set rightStrng = ""
i = UBound(strng)
rightStrng = Application.WorksheetFunction.Trim(rightStrng)
Set bCell.Offset(, 2) = rightStrng
Set bCell.Offset(, 1) = Left(aCell.Value, IIf(rightStrng <> "", InStrRev(bCell.Value, rightStrng) - 2, Len(bCell.Value)))
Next aCell
End Sub`