LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
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???








 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a variable spreadsheet reference in a formula 3Nails Excel Discussion (Misc queries) 6 October 26th 08 12:45 AM
Variable column reference in formula excel help acct[_2_] Excel Discussion (Misc queries) 2 January 16th 08 12:31 AM
XL how to change a cell reference in a formula to variable value? Bernard Excel Worksheet Functions 6 June 18th 07 09:22 AM
problem with cell reference in =sum(offset(cell reference,x,y,z,a)). Want cell ref to be variable. [email protected] Excel Worksheet Functions 2 December 11th 04 12:05 AM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM


All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"