I want to prevent users from leaving a blank cell in a listbox. I’m using the EditCell method to edit the cell which works fine. In the CellAction event I have the following code:
if trim(me.cell(row,column)) = “” then
me.cell(row,column) = OriginalCellValue // OriginalCellValue is a property set by the CellGotFocus event
beep
MsgBox “Cell cannot be left blank”
me.EditCell(row,column)
end if
All works fine apart from the last line which doesn’t appear to execute. Have also tried this in the CellLostFocus event but no difference. I’ve also tried listbox.setfocus after the MsgBox as well as a host of other attempts but nothing seems to work.
Does anyone have any ideas as to why this doesn’t work?
Mac OSX El Capitan