Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alphabet Position
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01370761
Message ID:
01370860
Views:
18
>>I am looking for a quick function that I can use while coding excel automation. Is there a function that you can send a number to and get the alphabet position back for it? For example if I send a 1 I get back A, 3 a C...
>>
>>Happy New Year!!!!!
>
>If you want this on the VFP side sure, here's one;
>
>
>LPARAMETERS lnPosition
>LOCAL lcLetters
>lcLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
>IF TYPE("lnPosition") <> "N" OR lnPosition < 0 OR lnPisiont > 26
>   * Error bad parameter passed
>
>ENDIF
>RETURN SUBSTR(lcLetters,lnPosition,1)
>
Jim,

For numbers > 26 here is
lcColLetter = IIF(lnCol>26, CHR(Int((lnCol - 1) / 26) + 64), "") + CHR(((lnCol - 1) % 26) + 65)

from http://berezniker.com/content/pages/visual-foxpro/excel-convert-column-number-column-reference
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform