I need to write to a text file certain numbers that are populated from excel. The reason this is difficult, is because the text file location is dynamic, but the file path will be defined in excel in a named cell called 'textfilepath'. The name of the file will be defined in excel by a cell named 'textfilename' . Lastly the data that needs to be replaced is never in the same line, but always is the line after the word 'PREP' The text that is replaced is always justified to the right at the 5th space. The value that replaces the number there is defined as 'increment';
So, I am looking for code that will open the file named 'textfilename' in the 'textfilepath', find the line after the word 'PREP', then look up the value in the 'increment' cell, and replace the number there, but keep the justification at 5.
This is a difficult task in my mind, but perhaps someone can figure it out. I am a novice when doing programing, as i use it just to automate my job.
So, I am looking for code that will open the file named 'textfilename' in the 'textfilepath', find the line after the word 'PREP', then look up the value in the 'increment' cell, and replace the number there, but keep the justification at 5.
This is a difficult task in my mind, but perhaps someone can figure it out. I am a novice when doing programing, as i use it just to automate my job.