+ Reply to Thread
Results 1 to 46 of 46

Change listbox value

Hybrid View

  1. #1
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change listbox value

    Hi Stignone

    I've added some Public Variables (see Module1) and I've changed the Initialize Event Code to capture the Range Start Row for each of your Page Ranges.
    I've modified the UpDate Button Code for Page 1 and Page 5 (CommandButton12 and CommandButton10); please make the same appropriate modifications on Page 2, 3 and 4 Update Buttons (CommandButton4, CommandButton6 and CommandButton8)

    Let me know of issues.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  2. #2
    Registered User
    Join Date
    10-19-2012
    Location
    Assen
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Change listbox value

    Quote Originally Posted by jaslake View Post
    Hi Stignone

    I've added some Public Variables (see Module1) and I've changed the Initialize Event Code to capture the Range Start Row for each of your Page Ranges.
    I've modified the UpDate Button Code for Page 1 and Page 5 (CommandButton12 and CommandButton10); please make the same appropriate modifications on Page 2, 3 and 4 Update Buttons (CommandButton4, CommandButton6 and CommandButton8)

    Let me know of issues.
    Hi John,

    Many thanks for your help works great now... can you maybe help me out with one more issue? i have some rows hidden in my original worksheet. How can i hide these in my listbox? there is thread, but i cant get it implemented in my code

    http://www.excelforum.com/excel-prog...55#post3034455

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change listbox value

    Hi Stignone

    In the UserForm Initialize Event, for each ListBox, change this line of code
    Private Sub UserForm_Initialize()
        Dim x As Long
        Dim k As Long
        Dim j As Long
        If MultiPage1.Value = 0 Then x = Sheets("INPUT BS").Range("D10:M50").Rows.Count '<--If you change the Range
        Rx1 = 10 '<----------------------------------------------------------------------You Must Change this
        ListBox1.List = Sheets("INPUT BS").Range("D10:M50").SpecialCells(xlCellTypeVisible).Value '<----Change this line
        For k = 1 To x    'rows
            For j = 1 To 10    'columns
                ListBox1.List(k - 1, j - 1) = VBA.Format(ListBox1.List(k - 1, j - 1), "0")
            Next
        Next

  4. #4
    Registered User
    Join Date
    10-19-2012
    Location
    Assen
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Change listbox value

    Hi John, I implemented it but what happens is that after after the rows that are hidden it stops showing the rest that is unhidden. So for example rows 1 till 10 are visible, 10 till 50 hidden, 50 till 100 visible. But it only shows not 1 till 10.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change listbox value

    Hi Stignone

    You're using Rows 10 to 50 for ListBox1...why are they hidden?

  6. #6
    Registered User
    Join Date
    10-19-2012
    Location
    Assen
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Change listbox value

    Quote Originally Posted by jaslake View Post
    Hi Stignone

    You're using Rows 10 to 50 for ListBox1...why are they hidden?
    Hi John in my example i uses D10:M500 so it's stops showing the rest of the rows that are visible after the first hidden rows.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change listbox value

    Hi Stignone

    I don't understand.

    The Code says this
    x = Sheets("INPUT BS").Range("D10:M50").Rows.Count
    But you indicated rows 10 till 50 are hidden
    10 till 50 hidden

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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