You are here:

Excel/Repeating a formula in VBA


QUESTION: I have a column from A1 of numbers, say 1 to 11. I want to create a re-normalised list.
I write a formula in B1 "=A1/$B$6"
The vaue given is 0.16666
Now I copy the formula to cells B2 to B11 by dragging the corner of B1. I get a new column of numbers (last one is B11 = 1.83333
What is a simple way of writing a macro to wite the new list?

ANSWER: Sub Answer()
  Range("B1:B" & Range("A10000").End(xlup).Row).FormulaR1C1="=rc[-1]/r6c2"
End Sub

But manually or using VBA you're going to get a circular reference in cell B6 -- the formula in B6 will be =A6/$B$6.

---------- FOLLOW-UP ----------

QUESTION: Brilliant!!
Of course I made a mistake "=A1/$B$6" should have been "=A1/$A$6" giving r6c1 at the end of your formula.

I have figured out the rc notation form your example, but where can i find a reference to this? In Excel Help? What do I look up?

Also, can you explain how the Range("A10000").End(xlup).Row code works (it obviously gives the last row number of the table, but how) ?


In help, you can search for
rc notation
and there's be many things to look at.
Range("A10000").end(xlup) is the code for effectively selecting cell A10000 and then pressing ctrl/Up-Arrow. The ".Row" part gives the row of effectively doing that. In reality, the cell is NOT selected and the ctrl/up-arrow "executed", but the effect is the same.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Bob Umlas


I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at


Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Excellence, The Expert, Microsoft

BA in math, Hofstra University, 1965

Awards and Honors
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2017 All rights reserved.