Results 1 to 4 of 4

Show dynamic data depending on selection of item from listbox.

Threaded View

  1. #1
    Registered User
    Join Date
    07-14-2015
    Location
    India
    MS-Off Ver
    3
    Posts
    24

    Show dynamic data depending on selection of item from listbox.

    I am creating a vb form. I want to show remaining data depending on listbox item selection. It will be appreciated if you would let me know full code.
    I had already created code but its for excel. I have no idea on how to do it in vb. The following is the code :

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Range("B1").Value = "GIS Swgr" Then
    Rows("6:6").EntireRow.Hidden = True
    Rows("15:15").EntireRow.Hidden = True
    Rows("16:16").EntireRow.Hidden = True
    Rows("17:17").EntireRow.Hidden = True
    Rows("18:18").EntireRow.Hidden = True
    Rows("20:20").EntireRow.Hidden = True

    ElseIf Range("B1").Value <> "GIS Swgr" Then
    Rows("6:6").EntireRow.Hidden = False
    Rows("15:15").EntireRow.Hidden = False
    Rows("16:16").EntireRow.Hidden = False
    Rows("17:17").EntireRow.Hidden = False
    Rows("18:18").EntireRow.Hidden = False
    Rows("20:20").EntireRow.Hidden = False

    If Range("B1").Value = "SF6 Swgr" Then
    Rows("20:20").EntireRow.Hidden = True
    Rows("21:21").EntireRow.Hidden = True

    ElseIf Range("B1").Value <> "SF6 Swgr" Then
    Rows("20:20").EntireRow.Hidden = False
    Rows("21:21").EntireRow.Hidden = False

    If Range("B1").Value = "MC Swgr" Then
    Rows("20:20").EntireRow.Hidden = True
    Rows("21:21").EntireRow.Hidden = True
    Rows("22:22").EntireRow.Hidden = True
    Rows("23:23").EntireRow.Hidden = True
    Rows("24:24").EntireRow.Hidden = True


    ElseIf Range("B1").Value <> "MC Swgr" Then
    Rows("20:20").EntireRow.Hidden = False
    Rows("21:21").EntireRow.Hidden = False
    Rows("22:22").EntireRow.Hidden = False
    Rows("23:23").EntireRow.Hidden = False
    Rows("24:24").EntireRow.Hidden = False

    If Range("B1").Value = "ME Swgr" Then
    Rows("20:20").EntireRow.Hidden = True
    Rows("21:21").EntireRow.Hidden = True
    Rows("22:22").EntireRow.Hidden = True
    Rows("23:23").EntireRow.Hidden = True
    Rows("24:24").EntireRow.Hidden = True


    ElseIf Range("B1").Value <> "ME Swgr" Then
    Rows("20:20").EntireRow.Hidden = False
    Rows("21:21").EntireRow.Hidden = False
    Rows("22:22").EntireRow.Hidden = False
    Rows("23:23").EntireRow.Hidden = False
    Rows("24:24").EntireRow.Hidden = False

    End If
    End If
    End If
    End If

    End Sub


    The code means. If user selects GIS Swgr in listbox then rows 6,15,16,17... will get hidden. I created it in excel. Now i want to create it in vb form.

    Thanks.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Userform ListBox depending on a previous Listbox selection
    By Figolu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2015, 04:31 PM
  2. Userform ListBox depending on a previous Listbox selection
    By Figolu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2015, 02:08 PM
  3. [SOLVED] first item in listbox does not show in listbox
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-19-2013, 10:33 AM
  4. [SOLVED] Indexing proper range in listbox depending on selection in previous listbox
    By bloodmeat in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2013, 02:31 PM
  5. Action depending on Listbox Selection
    By audioboxer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2012, 02:51 PM
  6. Replies: 0
    Last Post: 06-15-2011, 10:36 AM
  7. Multi select Listbox Items selection based on other Listbox item selection.
    By srinivassathi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2011, 05:53 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