Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP Equivalent to Excel CORREL function
Message
De
17/10/2003 07:17:30
 
 
À
17/10/2003 04:55:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00838799
Message ID:
00839664
Vues:
47
>No, the issue is how to relate to a particular cell.
>Assuming that this is cell BF133, how can VFP find out the name of this cell?
>I know there is a way to refer to cells using the RIC1 (row 1 column 1), rather than A1, but could never fit it into a formula.
>I know we go off the (VFP) discussion, so I will do some VBA experiments to try and find out. If you can help, I appreciate that, otherwise, don't worry.
>Jonathan
* to get the address of a cell:
cCell = loExcel.ActiveCell.Address

* to use relative (R1C1) positioning you say "so many rows down", so many "columns right"
* where negative numbers are accepted to move the other way (up,left).
oExcel = CreateObject("Excel.Application")
oWorkBook=loExcel.Workbooks.Add
oExcel.Range("A1").Select
oExcel.ActiveCell.FormulaR1C1 = "1"
oExcel.Range("A2").Select
oExcel.ActiveCell.FormulaR1C1 = "2"
oExcel.Range("A3").Select
oExcel.ActiveCell.FormulaR1C1 = "3"
oExcel.Range("B1").Select
oExcel.ActiveCell.FormulaR1C1 = "3"
oExcel.Range("B2").Select
oExcel.ActiveCell.FormulaR1C1 = "2"
oExcel.Range("B3").Select
oExcel.ActiveCell.FormulaR1C1 = "1"
oExcel.Range("A4").Select
oExcel.ActiveCell.FormulaR1C1 = "=CORREL(R[-3]C:R[-1]C,R[-3]C[1]:R[-1]C[1])"

* to write a formula:
oExcel.Range(cCell).Formula = "=Sum(B1:B3)"

* or variables
oExcel.Range(cCell).Formula = "=Sum(" + cCellFrom + ":" + cCellTo + ")"
Does this help?


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform