PDA

View Full Version : Inserting lines in text file according to a list



simonew
08-27-2019, 04:12 PM
I have a large text file which contains data listed vertically. For example consider a file which has info about "people" listed like so:
24884
I need to add a line of data only for some entries at particular position within that entry. E.g. I have a .xls file that lists all the people that are female, and I want to add a line that says "Gender = Female" - only for those listed in the excel file.
24885

End result would be:
24886

Does anyone know how to achieve this with a macro? Bonus points if you can work out how to insert the line at particular position - e.g. under "Eyes = **".

Thanks,

p45cal
08-28-2019, 09:07 AM
What version of Excel are you using? I'd consider using Power Query.
Apart from that, could you attach a copy of the text file which has not been edited by Excel, ever?
Sure, if it's too big or sensitive, cut it down in size by removing chunks of it in a text editor such as notepad. This is to preserve the file's characteristics.