+ Reply to Thread
Results 1 to 2 of 2

Adding Similar code to a Private Sub Worksheet_Calculate()

  1. #1
    Forum Contributor
    Join Date
    03-02-2010
    Location
    Northumberland, England
    MS-Off Ver
    Excel 2016
    Posts
    143

    Adding Similar code to a Private Sub Worksheet_Calculate()

    Hi Im trying to add another sequence of code to this Private Sub Worksheet_Calculate.

    I only need to change
    Please Login or Register  to view this content.
    to F501

    and
    Please Login or Register  to view this content.
    to CAll AWC but dont know how to insert these new lines and trigger a new macro.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Adding Similar code to a Private Sub Worksheet_Calculate()

    Hi there,

    Take a look at the attached workbook and see if I've understood your requirements correctly. It uses the following code:

    Please Login or Register  to view this content.
    The highlighted values may be altered to suit your requirements.


    In the above code I've used Call statements - this is a personal preference because the Application.Run method has shortcomings in certain circumstances, but if you want, you can replace the following:

    Please Login or Register  to view this content.

    with:

    Please Login or Register  to view this content.

    The Module-Level Constants "msMACRO_NAME_1" and "msMACRO_NAME_2" can then be defined instead as Procedure-Level constants in the "Worksheet_Calculate" procedure.

    The above alternative approach assumes that the "WC" and AWC" routines are contained in the VBA CodeModule of the worksheet in question.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    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. What is wrong with my Worksheet_Calculate timestamp code?
    By arwebb0264 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-15-2016, 02:42 PM
  2. [SOLVED] Code for adding similar data rowwise
    By SParikh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2014, 06:09 AM
  3. Convert code to a Worksheet_Calculate version?
    By maistral in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-31-2013, 12:30 PM
  4. [SOLVED] adding a worksheet with a pre-specified private sub.
    By Brammer88 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-20-2013, 02:05 PM
  5. [SOLVED] Adding a field limitation (0-1 only) to a Private sub inputbox prompt.
    By Coachwooten in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2012, 12:10 PM
  6. [SOLVED] Combine Two Similar Private Subs
    By swordswinger710 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-27-2012, 02:15 PM
  7. Adding a lot of similar names with VB code
    By nofzinger in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2010, 06:28 PM

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