Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Run macro when 2 cells are equal

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Mr. Excel,

    I am using MS Excel 97 as a data acquisition program. A serial device is sending data to a specific cell (4,6) via DDE. The numeric value of this incoming data varies between 0 and 360.

    I want to execute a macro when the incoming data (the data in 4,6) becomes equal to a preset constant that I have placed in another cell (4,8).

    This may be a simple task, but I have not found a working example from the FAQ lists yet.


    Cordially,

    Russell Thynes

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Put the following code in the module for your worksheet that contains the cells in question:

    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    Set Target = Cells(4, 6)
    If Target = Cells(4, 8) Then MsgBox "Cells are equal"
    End Sub
    Replace the Msgbox function with the Call function and your macro.

    _________________
    Hope this helps.
    Kind regards, Al.

    [ This Message was edited by: Al Chara on 2002-04-10 16:04 ]

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •