ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Code names in formulas (https://www.excelbanter.com/excel-programming/369663-re-using-code-names-formulas.html)

Bob Phillips

Using Code names in formulas
 
I think she means the worksheet's codename, not a variable value. Check
Dave's response to see how it works.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"ducky" wrote in message
ups.com...

Barb Reinhardt wrote:
I've asked this elsewhere, but thought I'd put it up for more to see.

I have the following formula in my code:

Cells(i, "E").FormulaR1C1 = _
"=SUMPRODUCT(--('TESTING WORKSHEET'!R13C4:R20C4='Detail
Worksheet'!RC2),('TESTING WORKSHEET'!R13C18:R20C18))"

The code name for "TESTING WORKSHEET" is "TEST" and the code name for
"Detail Worksheet" is "DETAIL". I want to use the codename in the

formula.
How do I do this?

Thanks,


When you say code name, i think you mean variable. if that is what you
are trying to accomplish, you need to put your names into a string
variable. something like this:

dim TestWS as string
dim DetailWS as string
'make sure that you assign these variables a value at some point. then
to step in and out of the formula, it would look like this:

"=SUMPRODUCT(--('" & TestWS &"'!R13C4:R20C4='" & DetailWS & "
'!RC2),('" & TestWS &" '!R13C18:R20C18))"


hope this helps

AR





All times are GMT +1. The time now is 10:32 AM.

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