+ Reply to Thread
Results 1 to 5 of 5

Macro to run when cell value changes without hitting Enter key

  1. #1
    Registered User
    Join Date
    07-31-2013
    Location
    canada
    MS-Off Ver
    ms excel 2011
    Posts
    3

    Macro to run when cell value changes without hitting Enter key

    Hello everyone,

    I am new to programming and is very hopeful that someone can help me with a code to run the Macro that I already have.
    I have a worksheet with several tabs, and one tab gets the value (via link) from another tab. So every time the value on the Tab1 changes, the value on cell "D9" changes on Tab2, but the macro on Tab2, won't run unless I hit enter key on cell "D9".

    Can anyone please help me with a code that would run the code even without hitting the enter key.

    Please and Thank you!

    Sparkling13

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: Macro to run when cell value changes without hitting Enter key

    Not enough data, but most probably:
    In code of Sheet Tab1 insert handler of worksheet change event, something like:

    Please Login or Register  to view this content.
    Of course instead of A1 use the the address of cell in Tab1 which leads to change in Tab2

    And in YourMacro remember to give references to cells/ranges with worksheet name included
    so something like this in standard module:
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    07-31-2013
    Location
    canada
    MS-Off Ver
    ms excel 2011
    Posts
    3

    Re: Macro to run when cell value changes without hitting Enter key

    Thank you for your reply, Kaper.
    I will try to incorporate that to my current code.

    This is the code I have right now...


    'Revision Level
    If Not Application.Intersect(Target, rngD) Is Nothing Then
    'Captures changes in far-right columns
    If Cells(r, "I").Value2 = "" Then
    Cells(r, "I").Value2 = Cells(r, "D").Value2

    Else
    newCol = Cells(r, Columns.Count).End(xlToLeft).Column + 1
    'newCol = ws.UsedRange.Columns(ws.UsedRange.Columns.Count).Column + 1
    Columns("I").Copy
    Columns(newCol).PasteSpecial xlPasteFormats
    Cells(7, newCol).Value2 = "New Date - Received" & newCol - 9
    Cells(r, newCol).Value2 = Cells(r, "D").Value2
    If Cells(r, "D").Value2 <> "" Then
    Cells(r, "D").Interior.Color = vbRed 'change color to red if changed
    End If
    End If
    End If

    'Approval Status Level
    If Not Application.Intersect(Target, rngG) Is Nothing Then
    'Captures changes in far-right columns
    If Cells(r, "J").Value2 = "" Then
    Cells(r, "J").Value2 = Cells(r, "G").Value2
    Else
    newCol = Cells(r, Columns.Count).End(xlToLeft).Column + 1
    'newCol = ws.UsedRange.Columns(ws.UsedRange.Columns.Count).Column + 1
    Columns("J").Copy
    Columns(newCol).PasteSpecial xlPasteFormats
    Cells(7, newCol).Value2 = "New Date Approval Sent" & newCol - 10
    Cells(r, newCol).Value2 = Cells(r, "G").Value2
    If Cells(r, "G").Value2 <> "" Then
    Cells(r, "G").Interior.Color = vbRed 'change color to red if changed
    End If
    End If
    End If

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: Macro to run when cell value changes without hitting Enter key

    Where is the code (in which procedure is it in selectionChange or in Change event handler)?
    And in which sheet code?

    Please edit your post to comply with Rule 3 of the forum (using CODE tags).

  5. #5
    Registered User
    Join Date
    07-31-2013
    Location
    canada
    MS-Off Ver
    ms excel 2011
    Posts
    3

    Re: Macro to run when cell value changes without hitting Enter key

    It is in the Change event handler... When a date changes in Sheet 1, it should change in Sheet 3 as well, as this value is linked to Sheet 3.

    So it should record in Sheet 3, if the date on Sheet 1 has been changed.

    Thank you.

+ 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. Macro to run when cell value changes without hitting Enter key
    By sparkling13 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 12-11-2017, 04:37 PM
  2. Cell pointer moves down when hitting Enter
    By martinjr in forum Excel General
    Replies: 4
    Last Post: 01-24-2011, 10:37 PM
  3. Replies: 5
    Last Post: 12-06-2010, 04:39 PM
  4. Hitting Enter to Move Cursor to the Next Entry Cell
    By Cisnerax in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-25-2006, 07:10 AM
  5. Replies: 2
    Last Post: 10-20-2005, 05:05 PM
  6. [SOLVED] How can I create a new line in a cell in Excel by hitting enter?
    By Monica in forum Excel General
    Replies: 4
    Last Post: 07-01-2005, 02:05 PM
  7. [SOLVED] Changing direction of cursor after hitting enter - toggling with toolbar macro??
    By StargateFan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-09-2005, 09:06 AM

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