Results 1 to 1 of 1

Thread: TESTING Column Letter test Sort Last Row

  1. #1
    Senior Member alansidman's Avatar
    Join Date
    Apr 2012
    Posts
    125
    Rep Power
    13

    TESTING Column Letter test Sort Last Row

    Data Range
    A
    B
    C
    D
    1
    A
    A
    A
    A
    2
    B
    B
    B
    B
    3
    C
    C
    C
    C
    4
    D
    D
    D
    D
    5
    E
    E
    E
    E
    6
    F
    F
    F
    F



    https://excel.tips.net/T003254_Alpha...signation.html
    https://excelribbon.tips.net/T009600...d_Numbers.html
    https://excel.tips.net/T002273_Deter...d_or_Even.html
    http://www.excelforum.com/tips-and-t...explained.html
    http://www.excelforum.com/developmen...ml#post4213969


    Function Code for getting Column Letter from Column Number
    http://www.excelfox.com/forum/showth...=9837#post9837
    Public Function CL(ByVal lclm As Long) As String

    And Fuller version with explaining ‘Comments


    Code:
    Public Function CL(ByVal lclm As Long) As String '         http://www.excelforum.com/development-testing-forum/1101544-thread-post-appendix-no-reply-needed-please-do-not-delete-thanks-4.html#post4213980
        Do: Let CL = Chr(65 + (((lclm - 1) Mod 26))) & CL: Let lclm = (lclm - (1)) \ 26: Loop While lclm > 0
    End Function
    
    Function FukOutChrWithDoWhile(ByVal lclm As Long) As String 'Using chr function and Do while loop      For example http://www.excelforum.com/excel-programming-vba-macros/796472-how-to-go-from-column-number-to-column-letter.html
    Dim rest As Long 'Variable for what is "left over" after subtracting as many full 26's as possible
        Do
        '    Let rest = ((lclm - 1) Mod 26) 'Gives 0 to 25 for Column Number "Left over" 1 to 26. Better than ( lclm Mod 26 ) which gives 1 to 25 for clm 1 to 25 then 0 for 26
        '    Let FukOutChrWithDoWhile = Chr(65 + rest) & FukOutChrWithDoWhile 'Convert rest to Chr Number, initially with full number so the "units" (0-25), then number of 26's left over (if the number was so big to give any amount of 26's in it, then number of 26's in the 26's left over (if the number was so big to give any amount of 26 x 26's in it, Enit ?
        '    'OR
        Let FukOutChrWithDoWhile = Chr(65 + (((lclm - 1) Mod 26))) & FukOutChrWithDoWhile
        Let lclm = (lclm - (1)) \ 26 'This gives the number of 26's ( if any ), but just the excact part, in the next number down , - so applying the rest formula to this new number will again leave a difference "left over" rest.
        'lclm = (lclm - (rest + 1)) \ 26 ' As the number is effectively truncated here, any number from 1 to (rest +1)  will do in the formula
        Loop While lclm > 0 'Only loop further if number was big enough to still have 0-25's in it
    End Function
    Rem Ref    http://www.excelforum.com/development-testing-forum/1101544-thread-post-appendix-no-reply-needed-please-do-not-delete-thanks-4.html#post4213980
    Rem Ref    http://www.excelforum.com/tips-and-tutorials/1108643-vba-column-letter-from-column-number-explained.html


    Last Row
    https://fastexcel.wordpress.com/2017...xcel-with-vba/
    ' Dynamically getting the last row in worksheet referenced by Ws1
    https://excelfox.com/forum/showthrea...ll=1#post11467
    Last edited by DocAElstein; 01-24-2021 at 07:46 PM. Reason: using spare thread for tests. Just playing with my testies

Similar Threads

  1. Replies: 18
    Last Post: 03-17-2019, 06:10 PM
  2. Function Code for getting Column Letter from Column Number
    By DocAElstein in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 08-23-2014, 02:27 AM
  3. Replies: 6
    Last Post: 03-26-2014, 03:04 PM
  4. Converting a Column Number to a Column Letter
    By Rasm in forum Excel and VBA Tips and Tricks
    Replies: 6
    Last Post: 12-17-2012, 02:29 AM
  5. Replies: 11
    Last Post: 10-07-2012, 12:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •