+ Reply to Thread
Results 1 to 11 of 11

Show range in userform, Order by column first

  1. #1
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Show range in userform, Order by column first

    This code shows a selected worksheet range in userform textboxes.
    A 2D cell range is represented as a vertical set of textboxes, one below the other.
    The default order of the processed cells is Across then Down.
    Is there a property which allows the order to be Down then Across?
    See attached workbook.

    FORM CODE
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Show range in userform, Order by column first

    Use nested loops. You can't alter the way For Each iterates, so you'll either need a For Each through the Rows and then iterate each cell in the row, or use row/column indices in two For loops.
    Rory

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,155

    Re: Show range in userform, Order by column first

    !!!!!!!!!!!!!!!!! Deleted !!!!!!!!!!!!!!!!!!
    Last edited by sintek; 10-07-2019 at 08:48 AM. Reason: Code not for requirement
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Show range in userform, Order by column first

    Which part of the code gives the range?
    Tried "MyApplication.Selection" and other ways without success.

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Show range in userform, Order by column first

    MyApplication.Selection is indeed the selected range.

  6. #6
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Show range in userform, Order by column first

    I get an error message though when I have this line in the code.
    Please Login or Register  to view this content.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,155

    Re: Show range in userform, Order by column first

    Give this a go...
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by sintek; 10-07-2019 at 10:35 AM. Reason: Added sample file

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Show range in userform, Order by column first

    Try
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  9. #9
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Show range in userform, Order by column first

    Quote Originally Posted by Un-Do Re-Do View Post
    I get an error message though when I have this line in the code.
    Please Login or Register  to view this content.
    You're trying to output an array of values, which you can't do with one Debug.Print statement.

  10. #10
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Show range in userform, Order by column first

    Thanks to @sintek and @mikerickson for the solutions at post #7 and #8.
    At post #8, just change "Selection.Rows" with "Selection.Columns". I've used this one because the code structure is similar to the original post.

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,155

    Re: Show range in userform, Order by column first

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Thanks.gif

+ 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. how to show count of cells between range in userform
    By mazan2010 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2017, 01:23 PM
  2. [SOLVED] userform data to next empy row in ws - textbox number order same as column order
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-31-2017, 01:38 PM
  3. [SOLVED] Userform Launch - show userform when any cell in range on any worksheet is double clicked
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-27-2016, 03:38 AM
  4. Userform textfield to show the max value from a column
    By qclady in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2015, 08:17 PM
  5. Show range values in UserForm
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-08-2014, 07:30 AM
  6. [SOLVED] Show date and order number when the userform opens.
    By MariaPap in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-23-2013, 04:50 AM
  7. Pivot table to show certain column in descending order
    By rushdenx1 in forum Excel General
    Replies: 1
    Last Post: 01-04-2012, 05:32 AM

Tags for this Thread

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