I'm trying to write a VBA Excel Macro to create an algorithm that will find text and find next adjacent cell to display text in a msgbox for example:
I parsed the sentence "The building has a broken pipe beneath the first floor." into separate cells. Using this code:
Sub Module3()
'
' Parse text
'
'
Selection.TextToColumns Destination:=Range("A2"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1)), TrailingMinusNumbers:=True
End Sub
The sentence is now parsed. Once I select a cell how can I display the adjacent cell in a msgbox
- Find Text “broken”
- Find text “broken” and adjacent word “pipe”