返回列表 上一主題 發帖

如何使用多個KeyCode~TextBox1.Activate能使用迴圈撰寫嗎?(已解決,感謝O大)

如何使用多個KeyCode~TextBox1.Activate能使用迴圈撰寫嗎?(已解決,感謝O大)

本帖最後由 av8d 於 2011-9-12 11:32 編輯

Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    i = 49
    For j = 8 To 13
    If KeyCode = i Then
    工作表1.OLEObjects("TextBox" & j).Activate
    i = i + 1
    Next
    End If
End Sub


以上該如何撰寫才能寫出迴圈?(如下)
    If KeyCode = 49 Then
    TextBox8.Activate
    End If

    If KeyCode = 50 Then
    TextBox9.Activate
    End If

    If KeyCode = 51 Then
    TextBox10.Activate
    End If

以此類推~

        靜思自在 : 信心、毅力、勇氣三者具備,則天下沒有做不成的事。
返回列表 上一主題