Writing a worksheetFunction to the worksheet

Rasm

Well-known Member
Joined
Feb 9, 2011
Messages
505
I m trying to populate a cell with the text


=STEYX(J13:J26;K13:K26)

My code below writes that into the Avar (Dimmed as a Variant)



Avar = "=STEYX(" & Split(Cells(1, i).Address, "$")(1) & Trim(Str(FirstRowResult)) & ":" & Split(Cells(1, i).Address, "$")(1) & Trim(Str(LastRowResult)) & ";" & Split(Cells(1, ii).Address, "$")(1) & Trim(Str(FirstRowResult)) & ":" & Split(Cells(1, ii).Address, "$")(1) & Trim(Str(LastRowResult)) & ")"



The code below - gives an error

.Cells(Along, ii) = Avar


If I use the code blow- it works - but only the calculated value is shown - not how it is calculated (I want it to show what range is used) - I have populated the two arrays with the values from row 13 to 26 for column K & L

Application.WorksheetFunction.StEyx(RefVal, PredVal)
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
What is the resulting string assigned to Avar?

Also, does your version of Excel use a semi-colon as a list separator, as per your example? Or does it actually use a comma as a list separator?
 
Upvote 0
The way I solve problems with writing formula into cells is to remove the "=" from the front of the formula so that you just write Text. then go to the cell and manually put the "=" back in , EXCEL then very kindly highlights where the error is.
 
Upvote 0
What is the resulting string assigned to Avar?

Also, does your version of Excel use a semi-colon as a list separator, as per your example? Or does it actually use a comma as a list separator?



Avar=
=STEYX(J13:J26;K13:K26)

If I add a ' (remark) - then goto to the cell where it wrote

'=STEYX(J13:J26;K13:K26)

and remove the ' ---- then it works



 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,981
Members
448,538
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top