View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
STEVE BELL STEVE BELL is offline
external usenet poster
 
Posts: 692
Default How to set formula with cell reference with a variable

Glad it was a simple fix... Good to hear it is working...

And You are Very Welcome!

Keep on Exceling...

--
steveB

Remove "AYN" from email to respond
"momotaro" wrote in message
...
That was the answer, Steve!
IT worked, Thank you.


"STEVE BELL" wrote:

I think you just need to your variable as a number type (double, long,
integer, etc)
dim strRow_Number as Double
strRow_Number = 100
than
ActiveCell.FormulaR1C1 = "=SUM(R[1]C[-2]:R[" & strRow_Number &
"]C[-2])"
--
steveB

Remove "AYN" from email to respond
"momotaro" wrote in message
...

I would like to set formula that includes a string variable in VBA. The
following
code caused "Runtime error 1004 Application-defined or Object-defined
error"

dim strRow_Number as String
strRow_Number = "100"

ActiveCell.FormulaR1C1 = "=SUM(R[1]C[-2]:R[" & strRow_Number &
"]C[-2])"

How can I set the formula with variables???