Liberty BASIC Community Forum
« Convert column number to column string (Excel) »

Welcome Guest. Please Login or Register.
Nov 17th, 2017, 1:24pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Convert column number to column string (Excel)  (Read 544 times)
hans
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 56
xx Convert column number to column string (Excel)
« Thread started on: Jan 12th, 2015, 05:09am »

In case anybody needs this too.

Hans

Code:
    print ExcelColString$(591)
END
FUNCTION ExcelColString$(NumericColNum)
'=Converts a column number to a column string in Excel format; eg. A,AE,BCD
    if ISINTEGER(NumericColNum)=0 then notice "Column number must be an integer!" : exit function
    do
        modulo = (NumericColNum-1) mod 26
        ExcelColString$ = Chr$(65 + modulo) + ExcelColString$
        NumericColNum = int((NumericColNum-modulo)/26)
    loop while NumericColNum>0
END FUNCTION
FUNCTION ISINTEGER(val)
   if val-int(val)=0 then
      ISINTEGER=1
   else
      ISINTEGER=0
   end if
END FUNCTION
 
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls