PDA

View Full Version : Solved: Rearrange the location in txt file by EXcel VBA



Ann_BBO
11-27-2009, 08:36 PM
Hi All,

I have written a marco to convert the data from excel sheet to txt file. In txt file, we have this set pattern:

#Comment1
#Comment2

# (String 1)
sc 0502
sc 070C
sc 0091

# (String 2)
sc 0502
sc 1A0F
sc 3380

sc 8607
sc 861A

First sc is the starting command (i.e. sc 0502). The middle of sc is the Block and Offset (i.e.sc 070C) where the last sc is the value (i.e. sc 0091) and final we have a ending command to close the block accordingly. Now, i would like the pattern that all block which contains "1A" (i.e. sc 1Axx) to put in first position. The Result like this:

#Comment1
#Comment2

# (String 2)
sc 0502
sc 1A0F
sc 3380

# (String 1)
sc 0502
sc 070C
sc 0091

sc 861A
sc 8607

Since my marco is already complicated to generate the output txt file. Therefore, i would like to do this action after output txt file. For details, see the attached zip file. Thanks!

Thanks,
Ann

Ann_BBO
11-28-2009, 02:57 AM
I have solved it in marco (but notthe method for rearrange the location in txt file). BTW, if someone would like to share the methods on it. Welcome.

Thanks,
Ann