Results 1 to 3 of 3

Thread: Selecting/deselecting rows - then sort & Hide/Unhide rows

  1. #1
    Senior Member
    Join Date
    Apr 2011
    Posts
    190
    Rep Power
    14

    Selecting/deselecting rows - then sort & Hide/Unhide rows

    The purpose of this code is to easily sort data – then hide/unhide rows – next I assign a product code (using treeview keys – so I can have as many relationships as I want – emulating a relational database – Next I can query product codes – that way I can find say all 6 cylinder cars of the brand Ford or the brand Chevy or both and so on – all depends on my treeview key – Anyway this code don’t show the treeview).

    The code allow you to select entire rows on the sheet directly using Shift+Mouse_Click or Ctrl+Mouse_click – there is a hidden userform that that will track your selection if the range exceeds 254 characters – dam 255 number in Excel. So simply select rows using the mouse – on the visible userform use the ‘Add’ to assign a True value or ‘Remove’ to assign a False value for the highlighted rows in the column ‘Selected’. You may also toggle the True/False value by a simple click on a cell in the Selected Column – again these changes are trapped by the hidden form. This also allow you to load other forms and simply get the selections from the hidden form. This feature has only real value if you have > 10K rows or something like that in your sheet.
    After you made your selection you can checkmark the selected records-any records with the value false can now be hidden – ‘Hide by checking box’ and UnHidden by unchecking box.
    You can click on the header column to sort by that value – just like an explorer bar option – unfortunately to toggle between ascending/descending – you have to click cell above or below the header – then click the header again – I cannot figure out how to trigger event without pulsing the value. The purpose of the Position column is simply to allow the data to be sorted in order of entry.
    If anybody has suggestions or similar routines I would be very appreciative. I have been using VB6 for years – but is new to all the XL functions. So just finding my way around in coding in XL.
    Attached Files Attached Files
    xl2007 - Windows 7
    xl hates the 255 number

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi Rasm,

    You'll find in this post how I tackle the 255 character limit.

  3. #3
    Senior Member
    Join Date
    Apr 2011
    Posts
    190
    Rep Power
    14
    Yes - I properly should take another look - thanks for reminding me - however what I use right now is actually quite quick. But I definitely will. The portion of the code here is what I use on a number of different userforms - so I will optimize it further in this development code. Before I implement across the board.
    xl2007 - Windows 7
    xl hates the 255 number

Similar Threads

  1. VBA To Hide And Unhide Rows
    By paul_pearson in forum Excel Help
    Replies: 10
    Last Post: 05-08-2013, 03:14 AM
  2. Delete unwanted rows & column
    By sanjeevi888 in forum Excel Help
    Replies: 1
    Last Post: 09-30-2012, 08:52 AM
  3. How to condense several rows into fewer rows?
    By gavin_machine in forum Excel Help
    Replies: 2
    Last Post: 10-03-2011, 11:15 PM
  4. Hide/Unhide Columns with Listbox
    By obed_cruz in forum Excel Help
    Replies: 2
    Last Post: 05-28-2011, 07:26 PM
  5. Hide and Unhide Rows and Columns
    By Admin in forum Download Center
    Replies: 0
    Last Post: 05-11-2011, 12:00 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
  •