98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Worksheet selection change event
Worksheet selection change event
Resolved · Low Priority · Version 2010
Mal has attended:
No courses
Worksheet selection change event
I created a workbook with single worksheet. I copied this sheet and did some data sorting. I created a third worksheet as a copy of the original and sorted differently. I then opened vba and went to worksheet three and clicked on view code and created a worksheet selection change event private sub. The sub used intersect methods to allow me to select several cells and then sum the highlighted cells, put in clipboard and then paste the sum. The event did not trigger. I tried selecting cells in worksheet 2 and it did not trigger. However, it did trigger when cells were selected in the original worksheet even though the private sub was in the code section for worksheet 3. Note that I did not rename worksheets. The worksheet name for sheet three was the same as the first with the (3) appended. Why is the event not triggering from the correct worksheet. Do worksheet names have to be unique?
RE: worksheet selection change event
Sorry for the previous post. I eventually found the error. In VBA, the project viewer shows Sheet3 to actually be the original worksheet. Sheet1 is the copy with the appended (3) in the name. So I just saw sheet 3 and assumed it was the one with copy (3). This was not intuitive. Only reason I can think of is the sheet ordering is named left to right by tab and my new sheets were added to the left of any existing sheets so the newest was also the first sheet from the left looking at the tabs.
RE: worksheet selection change event
Hi Mal
Thank you for using our forum
Is this something you still require assistance with?
Kind regards
Wendy Canelas
Microsoft Office Trainer
Tue 8 May 2018: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Finding your worksheets quicklyThe arrows to the left of the worksheets are used to move between one sheet at a time or first / last worksheet, but if you right click on the arrow buttons it gives you all worksheets in your workbook. |