+ Reply to Thread
Results 1 to 9 of 9

Assigning Event handler to a button

  1. #1
    Registered User
    Join Date
    05-17-2015
    Location
    Manchester
    MS-Off Ver
    2010, 2007
    Posts
    6

    Question Assigning Event handler to a button

    Hello there,

    It is my first post, so I will like to say thanks to everyone who has helped somebody in one way or the other on this forum. I have been able to work around some vba issues just by reading the answers from other threads.
    I am new to vba programming in excel so my question might look simple but I have battled with it for hours, SOS any one.

    the code I created, works well and triggers for individual cells in the range but prematurely, instead I want to be able to click a button
    after I have inputed all the data so that the event handler will then run through my target named range before calling the concerned macro email automation.

    Hope my explanation is clear a little, my coding might also be amateurish. bear with me.

    thanks in advance.


    Please Login or Register  to view this content.
    Last edited by Tes0506; 05-19-2015 at 01:37 PM. Reason: code tags

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Assigning Event handler to a button

    If you want the code to run only when the button is pressed get rid of the Change event.

    Then transfer the code into a sub in standard module, something like this,
    Please Login or Register  to view this content.
    and then either assign this to your (Forms) button or call it from your (ActiveX) button.

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    05-17-2015
    Location
    Manchester
    MS-Off Ver
    2010, 2007
    Posts
    6

    Re: Assigning Event handler to a button

    Thank you Norie!!..... it is almost working.

    the problem now is the code is calling several emails for all the daily data previously entered in the range. my screen is now full of "compose email".
    I want the code to just check the new entered data in the cells for the day, because my named range is like an entire column to cater for future daily data input.
    Thanks in advance.

    PS, hope my code tags worked

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Assigning Event handler to a button

    Is there a way to tell which data in the range is new?

    For example, a column with the date?

    Or perhaps a column with a status?

  5. #5
    Registered User
    Join Date
    05-17-2015
    Location
    Manchester
    MS-Off Ver
    2010, 2007
    Posts
    6

    Re: Assigning Event handler to a button

    the new data is entered daily into blank cells consecutively in the same column but next row. the dates are on the first column of the table eg date is in column A and the value being checked are in columns B and D, but the interest is on the new row with the new date of the day.


    Hope this helps.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Assigning Event handler to a button

    Could you upload an example workbook with dummy data?

    Include some old and new dummy data and indicate the rows for which an email should be sent.

  7. #7
    Registered User
    Join Date
    05-17-2015
    Location
    Manchester
    MS-Off Ver
    2010, 2007
    Posts
    6

    Re: Assigning Event handler to a button

    of course, working on it right away.....cant see any upload link though.

  8. #8
    Registered User
    Join Date
    05-17-2015
    Location
    Manchester
    MS-Off Ver
    2010, 2007
    Posts
    6

    Re: Assigning Event handler to a button

    okay. how do I attach here.
    I have tried the attach tag, still a newbie.
    Last edited by Tes0506; 05-19-2015 at 04:00 PM.

  9. #9
    Registered User
    Join Date
    05-17-2015
    Location
    Manchester
    MS-Off Ver
    2010, 2007
    Posts
    6

    Re: Assigning Event handler to a button

    I hope i got it right.
    the new data will be in the columns N1, N2, N3 and related rows with the new date.


    [attach]Dummy.xlsx[/attach]
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Change Event Handler
    By sighlent1 in forum Excel General
    Replies: 5
    Last Post: 02-15-2011, 11:47 AM
  2. Changing Event handler
    By Kop99 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-16-2009, 07:35 AM
  3. Event handler or a macro
    By jazbath in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-09-2008, 02:43 PM
  4. Event handler
    By VBA Noob in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-26-2006, 10:55 AM
  5. Event handler is invalid
    By Minh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-07-2005, 10:10 PM

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