Share via

select cell after ListBox selection

Anonymous
2017-10-23T19:54:47+00:00

Private Sub ListBox1_Click()

ActiveCell.Value = ListBox1.Value

ActiveCell.Offset(1, 0).Select

End Sub

click item 1, works

click item 2, works

click item 1, works

click item 1, not work

I guess because it is related to the ListBox index/value not changing???  Can I modify this where I can select the same item in succession?

thank you

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

OssieMac 48,001 Reputation points Volunteer Moderator
2017-10-23T22:52:41+00:00

Your comment. "I guess because it is related to the ListBox index/value not changing???  "

Yes! That is correct.

I am assuming that you have an ActiveX control and if so then you could use the LostFocus event and then instead of selecting the required cell and then selecting the value in the ListBox you could select the value in the ListBox and then select the cell where you want the value. Note that if you select the required cell for the value first then you will need to re-select the same cell to trigger the lost focus event and the lost focus event will populate the cell that you select after selecting the ListBox value.

Private Sub ListBox1_LostFocus()

    ActiveCell.Value = ListBox1.Value

    ActiveCell.Offset(1, 0).Select

End Sub

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2017-10-24T14:40:18+00:00

    hmm...ok.  not what i'm used to being able to do in Access, but it will have to do until Excel comes around.

    Was this answer helpful?

    0 comments No comments