+ Reply to Thread
Results 1 to 10 of 10

Userform-How to different align text in listbox

  1. #1
    Registered User
    Join Date
    05-07-2015
    Location
    Czech Republic
    MS-Off Ver
    2010
    Posts
    10

    Userform-How to different align text in listbox

    Hello
    I'm looking for a way in Userform to align the values in the ListBox columns differently.
    Does anyone know the solution?
    In ListBox
    1.column - Center
    2.column - Center
    .....
    7.column - Right
    8.column - Right
    9.column - Center
    Attached Files Attached Files
    Last edited by yardaz; 11-10-2017 at 12:46 PM.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,895

    Re: Userform-How to different align text in listbox

    Here's link to tutorial on exactly what you are looking for.

    https://wellsr.com/vba/2017/excel/al...rform-listbox/

    Basically, it uses Class module to manage column alignment within same listbox.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Userform-How to different align text in listbox

    it would be easy to use ListView instead of Listbox for different alignment between columns
    1. Thank those who have helped you by clicking the Star * below the post.
    2. Please mark your post [SOLVED] if it has been answered satisfactorily.

    Sincerely,
    Farid

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,895

    Re: Userform-How to different align text in listbox

    True. But it's not standard set in UserForm object.

    If Op wants to use ListView. Here's link to article on using it.
    https://10tec.com/articles/excel-vba...-examples.aspx

  5. #5
    Registered User
    Join Date
    05-07-2015
    Location
    Czech Republic
    MS-Off Ver
    2010
    Posts
    10

    Re: Userform-How to different align text in listbox

    Thank you, but after editing and implementation, it does not work...

  6. #6
    Registered User
    Join Date
    05-16-2015
    Location
    United States
    MS-Off Ver
    2010
    Posts
    3
    Quote Originally Posted by yardaz View Post
    Thank you, but after editing and implementation, it does not work...
    Hi, yardaz,

    The solution provided via the link to my site from CK76 should certainly work. I'd double check to be sure it's implemented as written.

    I'm on mobile at the moment so I haven't checked your original attachment. What OS and version of Excel are you using?
    Ryan Wells
    wellsr.com

  7. #7
    Registered User
    Join Date
    05-07-2015
    Location
    Czech Republic
    MS-Off Ver
    2010
    Posts
    10

    Re: Userform-How to different align text in listbox

    Hi wellsr :
    Win 10 and Office 2010

  8. #8
    Registered User
    Join Date
    05-16-2015
    Location
    United States
    MS-Off Ver
    2010
    Posts
    3

    Re: Userform-How to different align text in listbox

    Hi, yardaz,

    That's the same system I use. Please try the steps in the tutorial again and make sure all classes are named exactly as listed in the tutorial. :-)

  9. #9
    Registered User
    Join Date
    05-07-2015
    Location
    Czech Republic
    MS-Off Ver
    2010
    Posts
    10

    Re: Userform-How to different align text in listbox

    wellsr:
    OK.I will try.
    Thank you for your time!

  10. #10
    Registered User
    Join Date
    06-11-2020
    Location
    US
    MS-Off Ver
    2016
    Posts
    1

    Re: Userform-How to different align text in listbox

    Hi- is there a way for this code to work with a rowsource that has already been defined? I am getting an error message "run-time error '70': could not set the List property. Permission Denied". I believe it has to do with the rowsource being set, as I was able to get the code to work for another area of code where the rowsource was not set.

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA excel to word insert footer (Text - Left align) & (Page number - Right align)
    By Richavlaues in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2017, 06:22 PM
  2. find text in listbox on userform, delete row containing that text on spreadsheet
    By tsiguy96 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-09-2016, 03:11 AM
  3. Align in ListBox vba
    By jdasp49 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2013, 11:11 AM
  4. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 PM
  5. Text-align in buttons userform
    By Gert-Jan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2006, 11:10 PM
  6. [SOLVED] How to right-align data in a column of a listbox?
    By Stefano Gatto in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-10-2006, 03:40 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1