I cannot figure out how to get the listbox to behave in an excel-like fashion. What I seek is to have the user make an entry into a given cell, press return, and then have the next cell underneath automatically selected for entry with a focus ring around it and marked as editable with the cursor inside. This is how excel behaves, and my users would like to have the same convenience.
This may seen like a trivial task, and maybe it is, but it eludes me. I can achieve something similar by using a tab following entry, but not automatically without the tab. When one has a column of data to enter, using the tab between each entry is annoying and slows the process.
If anyone has a solution, I would be grateful,
Putting this code in the CellKeyDown event of the listbox works here:
if key = chr(13) then
if Keyboard.AsyncShiftKey then
if row > 0 then
me.editcell(row - 1, column)
if row < me.ListCount - 1 then
me.editcell(row + 1, column)
This will move up the list if the shift key is held down, and it will also ignore the return key as it pertains to the selected text of the current cell - not sure if that’s what you want.
(Note that it appears that you need to check for chr(13), not EndOfLine, even on Windows and presumably Linux, though I didn’t test on Linux.)
Many thanks for your help,
and Happy New Year
Robert, I believe that “Seth” at Bob Keeney’s has written a listbox subclass that does what you want. I couldn’t find it on their web page but perhaps if you contact Bob he can tell you how to obtain it.