Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default 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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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.


Reply
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
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
Setting ActiveCell color Peter Wells[_2_] Excel Programming 3 November 24th 06 07:39 PM
Copy content of ActiveCell in a variable Ulrik loves horses Excel Programming 2 October 8th 06 11:05 PM
setting range from activecell in macro Giz Excel Programming 1 March 11th 05 05:16 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM


All times are GMT +1. The time now is 06:29 AM.

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

About Us

"It's about Microsoft Excel"