PDA

View Full Version : Formula in a Control



Djblois
05-09-2007, 09:32 AM
I am trying to enter a formula into a control but I can't get it to work. I tried the help and the forums here and can't seem to find a solution.

Here is what I tried:

Me.lblTurnOver.Caption = Formula((365) / ((("B2") / 4) / (Me.WorkingCapital1.Value)))

the Formula is the (365/cell"B2"/4)/Control(WorkingCapital1)

lucas
05-09-2007, 09:39 AM
here's an example that puts the formula in a cell....see if you can adapt it:
With [E2]
.Formula = "=IF(D2=F2,D2,IF(ISBLANK(D2),F2,IF((LEN(SUBSTITUTE( TRIM(D2),CHAR(32),CHAR(32)&CHAR(32)))-LEN(TRIM(D2))+1)=1,LOOKUP(D2,Sheet2!$D$2:$D$110,Sh eet2!$A$2:$A$110),IF(OR(D2=""CONNIE"",D2=""DARLENE"",D2=""MICHAEL"",D2=""MARIANO"",D2=""JAMES""),F2,D2))))"
End With

Djblois
05-09-2007, 09:48 AM
Steve,

I think I am getting closer:

Me.lblTurnOver.Caption = "=(365) / ((Range("B2") / 4) / (Me.WorkingCapital1.Value))"

tell me if I am on the right track and where to what direction to head in please. I tried this and it still doesn't work

lucas
05-09-2007, 10:18 AM
Daniel,
I'll be honest...I'm not sure you can assign a formula to a control like this...why not use a cell reference?

Djblois
05-09-2007, 10:33 AM
I guess I will have to do the formula in a cell and then enter it in?

Paul_Hossler
05-09-2007, 11:03 AM
I'm guessing that you want to put the result of the formula in the label's caption ??? Not tested, but something like this maybe???

x = 365 / range ("B2").value
x = x / 4
x = x / Me.WorkingCapital1.Value

Me.lblTurnOver.Caption = CStr (x)


Paul