PDA

View Full Version : [SOLVED:] Cell selection issue



nikki333
04-27-2019, 04:26 PM
Hi folks

Sorry for asking that many questions, but I'd like to get my project right.

It's only a tiny, but annoying issue...that happens when someone does a modification on one specific sheet, another sheet gets a formatting.
That's desired to happen. The procedure involves some formatting and at last a removal of duplicates from a range within that other sheet.
That's working fine, but the issue is that when I select that other sheet, the range in which the duplicates were removed is still active/highlighted,
although the worksheet_Activate Event of that sheet has code to activate another cell; and indeed the other cell is activated, but still the old range is highlighted...very odd

I was thinking to jump sheets and activate a bit of this and that, but I don't like that as a solution.

Any ideas?

Paul_Hossler
04-27-2019, 05:44 PM
Try Application.ScreenUpdating = True and then False (if necessary)

Bob Phillips
04-28-2019, 05:17 AM
Also, if you are selecting cells on the worksheet, change it to just modify those cells without selects.

nikki333
04-29-2019, 09:25 AM
Try Application.ScreenUpdating = True and then False (if necessary)

Thanks for the input Paul. However, I already wrap each and every procedure at the beginning with :



Application: .screenupdating = false: .enableevents = false: end with


...and at the end with:



Application: .enableevents = true: .screenupdating = true: end with


So, I'm not sure what you suggest. Should I try to put a .screenupdating = true before doing stuff on the sheet that is not activated and then .screenupdating = false when done with that stuff on the other sheet?
If so, I'm afraid that this will lead to screen flickers again, which I absolutely hate

大灰狼1976
04-29-2019, 06:09 PM
Do not use select, Select must be used in very few cases.

nikki333
04-30-2019, 08:43 AM
There's no select in my code...it happens either due to sorting or removing duplicates

Paul_Hossler
04-30-2019, 02:11 PM
So, I'm not sure what you suggest. Should I try to put a .screenupdating = true before doing stuff on the sheet that is not activated and then .screenupdating = false when done with that stuff on the other sheet?
If so, I'm afraid that this will lead to screen flickers again, which I absolutely hate


I was suggesting that it MIGHT help if you turned on ScreenUpdating to force the screen to repaint after you made your updates, and then turned it off again right away

You could also try putting in a DoEvents in there also

Without a workbook to play with, I'm only guessing