+ Reply to Thread
Results 1 to 1 of 1

Combo box menu wouldn't read "0" zero number in menu ID, Please help!!!

  1. #1
    Registered User
    Join Date
    11-25-2020
    Location
    Japan
    MS-Off Ver
    365
    Posts
    1

    Post Combo box menu wouldn't read "0" zero number in menu ID, Please help!!!

    I am trying to create multiple combo box dependent menu (5 different category)

    Here is the code.


    Option Explicit

    Dim id_line As Integer ' 加工ライン名のシート
    Dim id_section As Integer ' メンテナス項目のシート
    Dim id_koukan As Integer '交換ヶ所のシート
    Dim id_subsection1 As Integer '交換部品その①のシート
    Dim id_subsection2 As Integer '交換部品その②のシート


    Private Sub CategoryArea_Click()

    End Sub

    Private Sub cbo_Kakoumei_Change()
    Dim Fila As Integer
    Dim Final As Integer

    cbo_Section.Clear

    With Sheet2 ' メンテナス項目のシート

    id_line = cbo_Kakoumei.ListIndex + 1

    Final = .Cells(1, 1).End(xlDown).Row

    For Fila = 2 To Final
    If Mid(.Cells(Fila, 1), 1, 1) = id_line Then
    cbo_Section.AddItem (.Cells(Fila, 2))
    End If
    Next

    End With

    End Sub

    Private Sub cbo_Section_Change()
    Dim Fila As Integer
    Dim Final As Integer

    cbo_KoukanKasho.Clear

    With Sheet3 ' 交換ヶ所のシート

    id_section = cbo_Section.ListIndex + 1

    Final = .Cells(1, 1).End(xlDown).Row

    For Fila = 2 To Final
    If Mid(.Cells(Fila, 1), 1, 1) = id_line And _
    Mid(.Cells(Fila, 1), 2, 2) = id_section Then

    cbo_KoukanKasho.AddItem (.Cells(Fila, 2))

    End If
    Next

    End With

    End Sub

    Private Sub cbo_KoukanKasho_Change()
    Dim Fila As Integer
    Dim Final As Integer

    cbo_Koukanbuhin1.Clear

    With Sheet4 '交換部品その①のシート

    id_koukan = cbo_KoukanKasho.ListIndex + 1


    Final = .Cells(1, 1).End(xlDown).Row

    For Fila = 1 To Final
    If Mid(.Cells(Fila, 1), 1, 1) = id_line And _
    Mid(.Cells(Fila, 1), 2, 2) = id_section And _
    Mid(.Cells(Fila, 1), 3, 1) = id_koukan Then

    cbo_Koukanbuhin1.AddItem (.Cells(Fila, 2))

    End If
    Next

    End With
    End Sub

    Private Sub cbo_Koukanbuhin1_Change()
    Dim Fila As Integer
    Dim Final As Integer

    cbo_Koukanbuhin2.Clear

    With Sheet5 '交換部品その②のシート

    id_subsection1 = cbo_Koukanbuhin1.ListIndex + 1


    Final = .Cells(1, 1).End(xlDown).Row

    For Fila = 2 To Final
    If Mid(.Cells(Fila, 1), 1, 1) = id_line And _
    Mid(.Cells(Fila, 1), 2, 2) = id_section And _
    Mid(.Cells(Fila, 1), 3, 1) = id_koukan And _
    Mid(.Cells(Fila, 1), 4, 1) = id_subsection1 Then

    cbo_Koukanbuhin2.AddItem (.Cells(Fila, 2))

    End If
    Next

    End With
    End Sub

    Private Sub cbo_Koukanbuhin2_Change()
    Dim Fila As Integer
    Dim Final As Integer

    With Sheet5 '交換部品その②のシート

    id_subsection2 = cbo_Koukanbuhin2.ListIndex + 1


    Final = .Cells(1, 1).End(xlDown).Row

    For Fila = 2 To Final
    If Mid(.Cells(Fila, 1), 1, 1) = id_line And _
    Mid(.Cells(Fila, 1), 2, 2) = id_section And _
    Mid(.Cells(Fila, 1), 3, 1) = id_koukan And _
    Mid(.Cells(Fila, 1), 4, 1) = id_subsection1 And _
    Mid(.Cells(Fila, 1), 5, 1) = id_subsection2 Then


    End If
    Next

    End With
    End Sub


    Private Sub UserForm_Initialize()
    Dim Fila As Integer
    Dim Final As Integer

    With Sheet1 '加工ライン名

    Final = .Cells(1, 1).End(xlDown).Row

    For Fila = 2 To Final
    If .Cells(Fila, 1) <> "" Then
    cbo_Kakoumei.AddItem (.Cells(Fila, 2))
    End If
    Next

    End With

    End Sub


    Private Sub CommandButton1_Click()
    Unload Me
    End Sub




    Attached Files Attached Files

+ 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. [SOLVED] Capture "cancel" on Standard Menu " close "
    By donwb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2020, 03:55 PM
  2. CommandBars("Worksheet Menu Bar").Controls("Tools").Enabled = Fals
    By Arturo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-06-2015, 05:43 AM
  3. [SOLVED] inputting a number representing "Time" spent on a "Task" under drop menu's
    By cubbymonkey in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-09-2014, 04:03 PM
  4. How to "pimp" (with FaceIds and shortcuts combo) a custom menu?
    By s80NL in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-15-2006, 07:48 PM
  5. Stop users from accessing "Protection" option from "Tools" menu
    By I Believe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-19-2005, 10:50 AM
  6. save and restore "Workbook Menu Bar" & "Cell" menus
    By Jeff Higgins in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2005, 10:08 PM

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