• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

Dynamic and Static in formula

Merry Christmas and Pre-Happy New Years to All.

Quick question about how to combine a static and dynamic formula in vba.

Here is what I have so far:

Dim r as String
r = target.row

Dim a as String
a = Target.Address

This is just for the "right hand side of the equation."  The left hand side is already done and fine.

Here goes:

"=((sheet1!T4)/(Sheet2!AF5 + Sheet3!AT3)) "/sheet4!AM" & r & "


So T4, AF5, and AT3 are all static meaning that the program should use these cells all the time.  In other words,  $T$4, $AF$5, and $AT$4.  

AM is the dynamic and slides up and down the range relative to the trigger.

Anybody want to take a quick shot at this?  I know I almost have it but I think my problem is around the sheet!4AM part and specifically the "dividing" part  "/".

thanks for you input.
0
BostonBob
Asked:
BostonBob
1 Solution
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Hello,

if you enter the formula with the .Formula command, then you can place the $ signs for absolute references, just like in a worksheet formula, so use  $T$4, $AF$5, and $AT$3 and no $ signs for Sheet4!AM

cheers, teylyn
0
 
BostonBobAuthor Commented:
I'll give that a go.  thanks.
0
 
BostonBobAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for BostonBob's comment #a39744399

for the following reason:

super quick response.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
Dale FyeCommented:
I think you selected the wrong answer as the correct one.

If so, click the Request Attention hyperlink at the bottom right corner of your original post, and tell the moderators you would like to reopen the question so that you can assign points to the correct response.
0
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Not sure the asker's "thank you" comment is the solution. He is thanking for the advice in comment #39744386, so that should be the accepted answer.
0
 
BostonBobAuthor Commented:
Still can't get this bad boy to work.  Can you suggest anything?

Worksheets("Basic").Range(a).offset(0,-12).formula = "=((Acc!$T$4)/(Q!$AF$1011 + constants!$AT$3)) "/(Brains!AY" & r & ")

The compiler does not like the right hand of the statement.  Any help is appreciated.

thanks,
0
 
QlemoC++ DeveloperCommented:
Watch your double quotes. The one in front of the slash is wrong, and should be moved to the very end of the string.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now