次のように、さまざまなデータとデータが配置されている行番号が入力された ListBox があります。
2012 年 3 月 31 日~2012 年 4 月 15 日 [商品 A]、行:12009
コマンド ボタンでは、クリックするとユーザーが特定の行に移動するコードを記述する必要があります。列は常に列 2 に固定されます
If something is selected in the listbox it will find the value after the colon (:) and select column 2 of that row number:
Private Sub CommandButton1_Click()
Dim selectedItem As String
If ListBox1.ListIndex <> -1 Then
selectedItem = ListBox1.List(ListBox1.ListIndex)
Cells(CInt(Mid(selectedItem, InStrRev(selectedItem, ":") + 1)), 2).Activate
End If
End Sub