Writing a worksheetFunction to the worksheet

Rasm

Well-known Member
Joined
Feb 9, 2011
Messages
500
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)
 

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,211
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?
 

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
1,319
Office Version
2010
Platform
Windows
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.
 

Rasm

Well-known Member
Joined
Feb 9, 2011
Messages
500
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



 

Watch MrExcel Video

Forum statistics

Threads
1,102,869
Messages
5,489,379
Members
407,686
Latest member
Chuck1960

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top