Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear cell with out calling worksheet_selectionchange event

Status
Not open for further replies.

wwgmr

MIS
Mar 12, 2001
174
US
Hi all, I am wanting to clear cells on a sheet that have a Worksheet_selectionchange event tied to them when someone clicks on that cell.

In my code for resetting the spread sheet, I am selecting many cells with range("Multible cell address").select to then clear selected. My problem is it causes the selection change event which I don't want to happen. Is there a way to avoid this and clear the contents of the cells?

Thanks!
 
Yes, don't select the cells. Just do
range("Multiple cell address").clear
In other cases, where it may not be quite so simple, you can also set
application.enableevents=false
for the duration of the event handler. But that's really not necessary in your case.


Rob
[flowerface]
 
Without knowing too much about your code for resetting the spreadsheet try Application.EnableEvents=False at the start and set to True at the end of your macro?

Chris ;-)

Visit for great xl and xl/VBA help
 
Thanks that helps, I was using the Macro recorder thats why I used select. Thanks again for help

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top