+ Reply to Thread
Results 1 to 6 of 6

running a macro when a cell changes

  1. #1
    Registered User
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    82

    running a macro when a cell changes

    I am searching for code to run a specific macro when i change the data in a particular cell.
    I am already running a Private Sub Worksheet_Change code on the sheet and when i add another, i get errors.

    This is what i have now and do not want to remove.
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    This is the type of thing found on an internet search which when added to the above code causes a runtime error.
    [Range(FindDate) represents the cell i called FindDate which when changed I want to run the Macro called FindSelectedDate]

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    How can i achieve this please?

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

    Re: running a macro when a cell changes

    How exactly did you add that to the existing code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    82

    Re: running a macro when a cell changes

    I simply pasted it into VBA. (see below)

    I did try adding just the If Not Intersect(Target, Range(FindDate)) Is Nothing Then FindSelectedDate before the End Sub but of course it failed too.


    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    2,523

    Re: running a macro when a cell changes

    When you have a named range you must use quotes around the name.
    Maybe this will work for you.
    Please Login or Register  to view this content.
    As a reminder, once your original request has been fulfilled please mark this thread as SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

    If you are happy with my help, then please consider clicking the add reputation button in the lower left hand corner of this post.

  5. #5
    Registered User
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    82

    Thumbs up Re: running a macro when a cell changes

    You are a legend, thank you so much.

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    2,523

    Re: running a macro when a cell changes

    My pleasure, thanks for the feedback and rep. points.

+ 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