Formula

  • Thread starter Thread starter Paul W Smith
  • Start date Start date
P

Paul W Smith

I wish to, through code, add a formula to a cell.

A1 = 6
B1 = 12

C1 must read - 6 of 12

Using the following in C1 gives the desired results - A1 & " of " & B1

However when I try to code this using C1.formula = "=A1 & " of " & B1"
there is a problem because the formula must be a string and this changes the
output.

Can anyone quickly give me a solution.

PWS
 
Paul

on the worksheet: =A1 & " of " & B1

in code: Range("C1").Formula = "=A1 & "" of "" & B1"

Regards

Trevor
 
Hi
try
Range("C1").FormulaR1C1 = "=R[0]C2 & "" of "" & R[0]C2"
 

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