Variables in Formulas

  • Thread starter Thread starter Filo
  • Start date Start date
F

Filo

I am a VB Beginner. The following line has a problem
because it is not working:

Range("A" & StartRow).Value = "= C & StartRow & - & B &
StartRow"

StartRow is a variable in the program; C and B are columns


I am basically trying to enter a variable into a formula.
Is it possible? If not, how can I subtract a cell (C &
Startrow) from another cell (B and Startrow), where the
row number is variable?

Thank you!
 
Try

Range("A" & StartRow).formula = "= C" & StartRow & " - B" & StartRow
 
THANK YOU!! It worked and is very helpful.

-----Original Message-----
try

Cells(startrow,"A").FormulaR1C1 = "=RC3 - RC2"



--
Patrick Molloy
Microsoft Excel MVP
---------------------------------



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top