VBA bewbie need help

  • Thread starter Thread starter SUNIL
  • Start date Start date
S

SUNIL

Range("A3").FormulaR1C1 = "=SUM(DATA!R[1]C[3]:R[10]C[3])"

i need to write macro to enter formula in cell A3 as above but need
C[3] to be C[Col%] WHERE Col%=column number on sheet data.
I tried to substitute a variable for "3" , but it does not work.

Also how do you get back the name of a column eg column 3 c.f "C"
 
col% = 10
Range("A3").FormulaR1C1 = "=SUM(DATA!R[1]C[" & col% & _
"]:R[10]C[" & col% & "])"
 

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