I have a text file that looks like:
ROOT: are DOBJ: money DOBJ: deal
DOBJ: products ROOT: count DOBJ: me DOBJ: deal
POBJ: amp ROOT: dads. POBJ: diapers
ROOT: get DOBJ: ecard DOBJ: it
ROOT: hutang
Each word is seperated by a tab. The file has about 50,000 lines like this. I want to format the file in such a way that each line starts with a ROOT followed by DOBJ, and then by POBJ. Every line has exactly one ROOT and the count of DOBJ/POBJ is unknown and can vary from 0-5. I tried to import the file into an excel sheet and trying doing a HLOOKUP but I am not getting what I want. I want to write the following logic in VBA (I have never used VBA before):
Dim sh As Worksheet
Dim rw As Range
Dim RowCount As Integer
Set sh = ActiveSheet
For Each rw In sh.Rows
if cellnumber(ROOT) != A
swap content(A), content of cell containing ROOT
Can someone help me with this code or tell me if there is a better way to do it either using Python or Excel?
