I need to format a formula in a cell on an excel sheet. I'm generating the sheet completely from code that I wrote in VB.

So I figured out a way to express my formulas in such a way that I can create them programatically and interpret them later on to make them show correctly on the sheet.

I need to put some parts of text in subscript. I tried it several ways:
cell.Characters(st, ln).Font.Subscript = True directly in vb code will at best put everything in subscript.

Another option I ended up implementing was a simple macro piloted by the two integer values that works on the active cell. It works as far as I could see but the formating dissapears once I change the active cell and it is very slow!

Can anyone please help me, I need a solution for this problem before I continue coding some more of my industrial plant.