ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using variable in setting and ActiveCell (https://www.excelbanter.com/excel-programming/426563-using-variable-setting-activecell.html)

dawall33

using variable in setting and ActiveCell
 
I would like to replace the 'a1' with a String variable I have defined
earlier in the script in the following line:

ActiveCell.FormulaR1C1"=SUMIF('1a'!R6C1:R[32]C1,R5C1:R[32]C1,'1a'!R6C10:R[32]C10)"

I am trying to automate the creation of summary lines on a sheet for a
range of sheets in my workbook.

Dave Peterson

using variable in setting and ActiveCell
 
maybe...

Dim myName as string
myName = "1A"

ActiveCell.FormulaR1C1 _
= "=SUMIF('" & myname & "'!R6C1:R[32]C1,R5C1:R[32]C1,'" _
& myname & "'!R6C10:R[32]C10)"


Untested, uncompiled.

dawall33 wrote:

I would like to replace the 'a1' with a String variable I have defined
earlier in the script in the following line:

ActiveCell.FormulaR1C1"=SUMIF('1a'!R6C1:R[32]C1,R5C1:R[32]C1,'1a'!R6C10:R[32]C10)"

I am trying to automate the creation of summary lines on a sheet for a
range of sheets in my workbook.


--

Dave Peterson

Jacob Skaria

using variable in setting and ActiveCell
 

strSheet = "1a"
ActiveCell.FormulaR1C1="=SUMIF('" & strSheet &
"'!R6C1:R[32]C1,R5C1:R[32]C1,'" & strSheet & "'!R6C10:R[32]C10)"
--
If this post helps click Yes
---------------
Jacob Skaria


"dawall33" wrote:

I would like to replace the 'a1' with a String variable I have defined
earlier in the script in the following line:

ActiveCell.FormulaR1C1"=SUMIF('1a'!R6C1:R[32]C1,R5C1:R[32]C1,'1a'!R6C10:R[32]C10)"

I am trying to automate the creation of summary lines on a sheet for a
range of sheets in my workbook.


Nigel[_2_]

using variable in setting and ActiveCell
 
Something like....

Dim sVar as String
sVar = "A1"
ActiveCell.FormulaR1C1"=SUMIF(" & sVar & "!R6C1:R[32]C1,R5C1:R[32]C1," &
sVar & "!R6C10:R[32]C10)"


--

Regards,
Nigel




"dawall33" wrote in message
...
I would like to replace the 'a1' with a String variable I have defined
earlier in the script in the following line:

ActiveCell.FormulaR1C1"=SUMIF('1a'!R6C1:R[32]C1,R5C1:R[32]C1,'1a'!R6C10:R[32]C10)"

I am trying to automate the creation of summary lines on a sheet for a
range of sheets in my workbook.



Rick Rothstein

using variable in setting and ActiveCell
 
Whenever you have a text String value and you want to insert the contents of
a String variable into that text String, you would break the text String at
the location you want the String variable's contents to go and concatenate
the String variable at that location. In your case (assuming it is the "1a"
that you show in your formula that you want replaced)...

ActiveCell.FormulaR1C1 "=SUMIF('" & YourVariable & _
"'!R6C1:R[32]C1,R5C1:R[32]C1,'" & _
YourVariable & "'!R6C10:R[32]C10)"

Just change my example String variable name of YourVariable to your actual
variable's name.

Note: I used line continuation characters to avoid having your newsreader
break the line at inappropriate locations... the above is really a single
statement.

--
Rick (MVP - Excel)


"dawall33" wrote in message
...
I would like to replace the 'a1' with a String variable I have defined
earlier in the script in the following line:

ActiveCell.FormulaR1C1"=SUMIF('1a'!R6C1:R[32]C1,R5C1:R[32]C1,'1a'!R6C10:R[32]C10)"

I am trying to automate the creation of summary lines on a sheet for a
range of sheets in my workbook.




All times are GMT +1. The time now is 01:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com