2014-10-16 3 views
0

우리 팀을위한 작업 목록을 만들고 입력 상자를 만든 새로운 작업을 입력하고 있습니다. "부서 질문" 에 입력해야하는 부서는 5 개입니다. 사람들이 잘못된 부서 이름을 입력하는 것을 방지합니다. 입력 상자에 드롭 다운 목록을 사용하고 싶습니다.입력란에 드롭 다운 목록 만들기

그물을 검색했지만 입력란에 드롭 다운 목록을 만드는 방법을 찾지 못했습니다. 이것이 가능한지 나는 모른다.

아무도 도와 줄 수 있습니까?

내가 입력에 쓴 코드는 다음과 같다 :

Private Sub Newaction_Click() 
    Dim content As String, date1 As Date, date2 As Date, department As String 
    Sheets("DO NOT DELETE").Rows("30:30").Copy 
    Rows("14:14").Select 
    Range("C14").Activate 
    Selection.Insert Shift:=xlDown 
    content = InputBox("describe the task") 
    Range("C14").Value = content 
    department = InputBox("to which department is the task assigned? ") '<-- here i want to create drop down list 
    Range("D14").Value = department 
    date1 = InputBox("when does the task start") 
    Range("F14").Value = date1 
    date2 = InputBox("when should the task be finished? ") 
    Range("G14").Value = date2 
End Sub 

답변

1

I 입력 박스를 사용하는 대신에 Excel에서 폼을 생성 하였다. 나는 calander에 날짜를 입력하기 위해 별도의 양식 (userfrom2 및 userform3)를 만든 날짜

Private Sub Newaction_Click() 

    Sheets("DO NOT DELETE").Rows("30:30").Copy 
    Rows("14:14").Select 
    Range("C14").Activate 
    Selection.Insert Shift:=xlDown 
    Cells(14, 3) = Taskd.Value 
    Cells(14, 5) = ComboBox1 
    Unload Me 
    UserForm2.Show 

End Sub 

Private Sub UserForm_Initialize() 

Taskd.Value = "" 

    With ComboBox1 
     .AddItem "Lean" 
     .AddItem "Maintenance" 
     .AddItem "Process Engineering" 
     .AddItem "Safety" 
     .AddItem "Workinstructions" 
    End With 

End Sub 

: 부서의 선택에 대한 내가 올바른 부서와 콤보 박스를 만들었습니다.

Private Sub MonthView1_DateClick(ByVal DateClicked As Date) 

    On Error Resume Next 
    startd = DateClicked 
    Cells(14, 6).Value = startd 
    Unload Me 
    UserForm3.Show 

End Sub 

Private Sub MonthView1_DateClick(ByVal DateClicked As Date) 

    On Error Resume Next 
    endd = DateClicked 
    Cells(14, 7).Value = endd 
    Unload Me 

End Sub 

Monthview1은 통해 활성화 할 수 있습니다 Excel에서 추가 옵션 -> 바로 도구 상자를 클릭 -> 추가 컨트롤을 선택 - 형태의 도구 상자> 마이크로 소프트 Monthviews 제어

관련 문제