If I am trying to create a column in a text file and populate that column with the same value which is found in a particular area of the text file, I can get Find/Replace with Regular Expression to successfully do this. Since the column will be right most, I find \r and replace with ,VALUE,\r where the VALUE is pasted from a previous copy (CTRL-C) command. The problem is that I can't make this work as a macro on other files because it records the value of the of CTRL-V instead of the keystroke command CTRL-V. Is there a way for the macro to emulate CTRL-V instead of filling in a particular value?
Added info: Every line in the file would need the pasted value. The reason is because every line contains a product number and a quantity. By being able to paste the value which is found in one of the headers, I can then link the lines to the order that is represented by the pasted value. So one table will contain order number, date, etc, where as the other table will contain the details of the order, i.e., the items.
This is a sample file:
ITEMNAME,ITEMID,QTY STORE #578 PO 0076875422 04-01-2014,SHIPPED
BLUE FISH,98799,3
RED FISH,48573,10
YELLOW SNAIL,94582,2
GREEN LIZARD-MEDIUM,32451,12
BLACK TARANTULA,29879,909
After running the script in notepad++ this file will look like this:
ITEMNAME,ITEMID,QTY STORE #578 PO 0076875422 04-01-2014,SHIPPED,ORDER_NUMBER
BLUE FISH,98799,3,,0076875422
RED FISH,48573,10,,0076875422
YELLOW SNAIL,94582,2,,0076875422
GREEN LIZARD-MEDIUM,32451,12,,0076875422
BLACK TARANTULA,29879,909,,0076875422
The header containing QTY contains other data: number of store,number of order, and date of order. The order number is always preceded by "PO " and it is always 10 digits long. The macro needs to be able to find it in each file and then add it to the end of each line, but it needs to be preceded by a comma to allow for a null value in the SHIPPED column. Of course, you'll also notice that a header was added to the header row called ORDER_NUMBER.
Where I was getting stuck was in being able to paste the value of the order number to the end of each line b/c in my current macro, it is only able to paste the value that is pasted at the time of recording, not the actual PO Number in the current file that is being worked on. So I figured if I could somehow record the CTRL-V keystroke after telling the Macro to find the PO number in the header row and copy it to the clipboard, that then it would work.