All of my macros to date are for formatting, so I'm running into a bit of a
problem for a formula macro. I tend to use this formula often when using
pivot tables, as I need the left most column of the pivot table to poplulate
on every row. For example, the pivot table will result the following:

John Green 2
Red 3
Brown 4
Julie Green 1
Red 2
Brown 3

I really need it to list the names on each row. So I tend to copy the table
and paste it as a value, then use the following formula in the immediate
column to the left of the table data to populate:

=IF(G22="",IF(F21="",G21,F21),G22)

Of course this must be relative to the copied cells position. How can I
write the macro for this and still keep the cell referencing correct?

Any help is much appreciated. Thanks!