+ Reply to Thread
Results 1 to 8 of 8

I want to call/run a macro immediate after a Range("C13") is entered

  1. #1
    Registered User
    Join Date
    08-06-2024
    Location
    Riverside, USA
    MS-Off Ver
    MS Office 2016
    Posts
    4

    I want to call/run a macro immediate after a Range("C13") is entered

    Simple code but it isn't calling the macro.. no sure why. Called macro highlights error digits of Pi entered (Works).

    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,645

    Re: I want to call/run a macro immediate after a Range("C13") is entered

    Hi there,

    You need to replace "Private Sub Pi_Entrd_Change(ByVal Target As Range)" with:

    Please Login or Register  to view this content.

    Please note that the routine needs to be entered in the VBA CodeModule of the worksheet in question, not in a standard VBA CodeModule.


    Hope this helps.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    08-06-2024
    Location
    Riverside, USA
    MS-Off Ver
    MS Office 2016
    Posts
    4

    Re: I want to call/run a macro immediate after a Range("C13") is entered

    Thanks Greg.
    I tried it and it did not work. That has me believing that I did not place the code into the worksheet properly as you mentions.
    I am a newbie to this vba, and not sure how to place the code into the worksheet module other than right-clicking "This workbook":


    VBAPRoject (Name of file)
    Microsoft Excel Objects
    Sheet1 (Pi)
    Sheet2 (Pi_By_Pos)
    Sheet3 (Pi_Keyd_In)
    This workbook
    Modules
    Module1 (where my three (including this one we are discussing)
    Module2 (Which is created by the right-click)

  4. #4
    Registered User
    Join Date
    08-06-2024
    Location
    Riverside, USA
    MS-Off Ver
    MS Office 2016
    Posts
    4

    Re: I want to call/run a macro immediate after a Range("C13") is entered

    I Moved it to "ThisWorkbook" (by viewing code)
    It is still not working.
    I tried to upload the file but it is 300kb too large and I'm not allowed to upload a zip file.
    Any suggestions for getting the file to you to assist you?

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

    Re: I want to call/run a macro immediate after a Range("C13") is entered

    Hi again,

    Thanks for your feedback.

    The code needs to be inserted in the VBA CodeModule of the worksheet which contains the C13 cell you wish to monitor - i.e., CodeModule "Sheet1" or "Sheet2" or "Sheet3".

    You can right-click on the tab of the worksheet in question, and then select "View Code" - this will open its VBA CodeModule, and you can then paste the code into it.

    Hope this helps.

    Regards,

    Greg M

  6. #6
    Registered User
    Join Date
    08-06-2024
    Location
    Riverside, USA
    MS-Off Ver
    MS Office 2016
    Posts
    4

    Re: I want to call/run a macro immediate after a Range("C13") is entered

    Did as asked and yes it went into the correct worksheet.
    Upon changing the Pi_Entrd_String and pressing [Enter], it is not calling the routine.

    I've uploaded the file to my google drive. If you give me an email, I can share the file with you.

    Thanks - Sean

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

    Re: I want to call/run a macro immediate after a Range("C13") is entered

    Email address sent to you via private message. Greg M

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

    Re: I want to call/run a macro immediate after a Range("C13") is entered

    Hi again Sean,

    Many thanks for that impressive workbook! I've modified it and emailed it back to you.

    As you said, the workbook is too large to post here, but I'm posting the code solution in case anyone else has been following this thread.

    I've inserted the required code in the VBA CodeModule of the "Pi_Keyd_In" worksheet.

    The additional code is a bit more complicated than originally envisioned, because your code may cause the value of the target cell to change. This will give rise to a "chasing your tail" situation unless Events are disabled before your code is executed. However, if you disable Events, you must make sure that they are automatically re-enabled if an error condition should occur.

    The following code is used:

    Please Login or Register  to view this content.

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

    Regards,

    Greg M

+ 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. Replies: 2
    Last Post: 03-16-2021, 02:11 PM
  2. "Error" or "Disallow" Entries If Data Entered in Wrong Cell
    By sage.tx in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-12-2017, 12:20 PM
  3. [SOLVED] Formula Needed to fill multiple cells with "No" when the word "No" is entered into a cell
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-09-2013, 05:36 PM
  4. How to call the Excel "range-selection tool"?
    By geophysicist in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2013, 01:23 PM
  5. Macro Error with code "Range("A65536").End(xlUp).EntireRow.Insert"
    By lukasj13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-30-2010, 08:48 PM
  6. Call a sub statement in "Personal Macro Workbook" from "ThisWorkbo
    By QC Coug in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2005, 03:05 PM
  7. Macro that runs entered value through "low" and "high" range
    By Vika.F in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-14-2005, 03:35 AM

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