ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Form Click event... (https://www.excelbanter.com/excel-programming/391618-form-click-event.html)

John Keith[_2_]

Form Click event...
 
Why does the _click event fire when deleting a row?

Here is what I am attempting...
I have a WB with 2 tabs.
The first tab contains a table list with multiple categories. I have a
routine that sorts the list by categories then deletes all named ranges, then
creates named ranges for each of the categories.
The 2nd tab has code that detects a double click with-in certain cells to
trigger a show of a user form with a listbox that has a rowsource set to
match a category range (from the 1st tab). The user then clicks on one of
the lists choices that then populates 2 cells on the worksheet based on the
target cell that was dbl clicked.

the ListBox1_Click routine seems to fire erroneously when deleting a row
from the 1st tab - the table sheet (the user form was hidden (as opposed to
unloaded)) I was able to get around the issue by testing for the
activesheet.name and exiting the _click routine when the sheet is not the one
that uses the form. I also had to re-hide the form.
It seems like a hidden request to show the form was executed. Anyone know
why this happens? I want to make the code more efficient so events aren't
looping through the code needlessly.

I used STOP's at the top of my routines,the 1st one was the Listbox1_Click
routine that got control after deleting the row.

Any ideas?
--
Regards,
John

Tom Ogilvy

Form Click event...
 
Don't tie the rowsource to the 1st tab. Load it without binding it to the
sheet.

--
Regards,
Tom Ogilvy


"John Keith" wrote:

Why does the _click event fire when deleting a row?

Here is what I am attempting...
I have a WB with 2 tabs.
The first tab contains a table list with multiple categories. I have a
routine that sorts the list by categories then deletes all named ranges, then
creates named ranges for each of the categories.
The 2nd tab has code that detects a double click with-in certain cells to
trigger a show of a user form with a listbox that has a rowsource set to
match a category range (from the 1st tab). The user then clicks on one of
the lists choices that then populates 2 cells on the worksheet based on the
target cell that was dbl clicked.

the ListBox1_Click routine seems to fire erroneously when deleting a row
from the 1st tab - the table sheet (the user form was hidden (as opposed to
unloaded)) I was able to get around the issue by testing for the
activesheet.name and exiting the _click routine when the sheet is not the one
that uses the form. I also had to re-hide the form.
It seems like a hidden request to show the form was executed. Anyone know
why this happens? I want to make the code more efficient so events aren't
looping through the code needlessly.

I used STOP's at the top of my routines,the 1st one was the Listbox1_Click
routine that got control after deleting the row.

Any ideas?
--
Regards,
John



All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com