+ Reply to Thread
Results 1 to 2 of 2

Help with Select Change Event

  1. #1
    Registered User
    Join Date
    10-22-2012
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    1

    Question Help with Select Change Event

    Hello All,

    I am currently working on a small personal project and trying to learn VBA concepts.

    Could anyone help me with applying select and change?

    Basically I have a couple of functions within my module that collect average, minimum and maximum etc in one sub. I want to be able to change the value after the application runs and having the output update automatically in the newly created sheet.

    Here is an example piece of my code:
    HTML Code: 

    Any help is greatly appreciated
    Cheers!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,485

    Re: Help with Select Change Event

    It would probably help us to help you if the code could be seen in context. I suggest that you upload a sample workbook.

    That said, you should not use Excel or VBA reserved words as the names of variables. In this instance, you have used max as the name of an array. Notice how, in max(i, 1) = Application.WorksheetFunction.max(mymax(i)), the max in Application.WorksheetFunction.max does not have a capital letter. This is because it will try to use the max that you have defined locally rather than the Excel function.

    There is also often some confusion about the Worksheet_SelectionChange and Worksheet_Change events. The first fires when you move between cells, that is, you select another cell. The second fires when you make a change to a cell. Given that you have not included the event header, it is difficult to know which one you are trying to use. In either case, it is usually better to restrict the event to monitoring a limited range or specific cells rather than being executed every time the event happens.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1