title: VBA Finding the distance between columns in excel
body: <p>I've decided to ask this question through examples.  I tried to explain the entire project but it seemed confusing if you weren't already working on the same project so here we go.</p>
  
  <p>As a user of the code I'm writing you need to decide which columns you want the program to actually grab and where to write all of the calculations to.  There are nine columns total that the user can play with, though I'll focus on the first four so it doesn't get too complex.</p>
  
  <p>The first two are the columns that my program needs in order to do it's calculations (explained later) and is really the basis for the entire project to run.  Let's call them Data_Before and Data_After.</p>
  
  <p>The next two columns are the calculations done from the information in Data_Before and Data_After.  These two columns are Diff and Percent.  Like the headers suggest Diff is Data_After - Data_Before and Percent is Diff / Data_Before.</p>
  
  <p>As of now the columns have to be right next to each other.  So if Data_Before is in column "A" then Data_After has to appear in "B" with Diff in "C" and Percent in "D".  This is because of my calculations coming from the record macro function.  The code that populates a cell in Diff and Percent are below</p>
  
  <pre><code>' Diff column
  ActiveCell.FormulaR1C1 = "=RC[-1]-RC[-2]" 
  ' Percent column
  ActiveCell.FormulaR1C1 = "=RC[-1]/RC[-3]" 
  </code></pre>
  
  <p>Sorry for the weird coloring in the code, the "Diff column" and "Percent column" are comments.  Anyway, here we have the FormulaR1C1 which makes the program inflexible.  The question being, how to do find the distance between the Diff column and the Data_Before or Data_After column so that the user can have the Data_Before in column "A" and Data_After in column "B" but the Diff and Percent columns wherever they want?</p>
  
  <p>Sorry for the length of the question.</p>