View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Before Right Click event

Firstly, I don't know how to get around the Event ordering issue. Personally
think there is no way, but I've been proven wrong before (tonight in fact!)

Basically you are trying to force a type of data validation. I think that
the same validation (and error) should apply even if the user right-clicks.

When I've done row level data entry, I create a userform for all the data
entry and create 4 buttons: Add, Edit, Copy, Delete. Then Lock/Protect the
worksheet.
Add opens the userform blank
Edit opens the userform with row contents, but will save overtop the current
row
Copy opens the userform with row contents, but will save as a new row.
Del deletes the row

All data validation is done in the userform.

This approach works well for me because each row update (when the userform
has it's save button clicked) can include a SQL database transaction.

I'm sorry, I don't have the easy answer.


"mohsinb" wrote in message
...
Hi,

Thanks for the quick response.


If the selection changes and the row changes then I check for some key
values in the previously selected row and if the previous row fails the
edits then the user is put back in the previous row to make corrections
or delete the row. This is to prevent them from entering rows without
filling in the key values. The previous rownumber is now set to the
active rownumber.

If the user changes selecion but not the row then no edits are done,
hoping that the user may comeback to the key columns after making
entries in non-key columns in the same row.

Right-click allows the user to insert a row(insertbutton on a form). On
a right-click on the same row - Selectionchange is fired but no edits
are done because they are in the same row. Now if I put the same
edits(before load form) in the WorkSheet_BeforeRightCLick it would
solve theproblem for the same row right-click, but the edits get
executed twice with the error messages being displayed twice when the
right-click is on a different row.

I hope the above is not too convoluted.

Thanks again.


---
Message posted from http://www.ExcelForum.com/