Macros and Formulae

  • Thread starter Thread starter Juan
  • Start date Start date
J

Juan

Okay, I have a super simple problem that for some reason continues t
elude me. I wrote a macro that includes a command that tell the targe
cell "B246" to state the answer from another cell or "K25". And the
another macro that changes it back to "G27". So my code looks lik
this for the first step:

Range("B246").Select
ActiveCell.FormulaR1C1 = "=K25"

Now when I run it all I get is "#NAME?" in the target cell (B246). An
I made sure to format the target cell the same as the contibuting cell
What am I missing
 
FormulaR1C1 requires R1C1-style references:

Range("B246").FormulaR1C1 = "=R25C11"

For A1-style references, use

Range("B246").Formula = "=K25"

Note that you almost never need to select a range in order to use it.
 
Hi
try
Range("B246").Formula = "=K25"

you have used the R1C1 formula property but did not assign a R1C1
conform formula. Also no need for a selection prior to assigning the
formula
 

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

Similar Threads

Inserting header @ page break 1
Macro to copy cells 2
Macro Question formula 8
Excel Run macro upon cell edit 0
Macro command 3
I need help with macro 1
Recorded macro has hard cell contents. 4
Macro 5

Back
Top