+ Reply to Thread
Results 1 to 4 of 4

Funtion and Cell

  1. #1
    henpat
    Guest

    Funtion and Cell

    Good morning/afternoon

    I need to execute a function only when the cell "B4" change of value.
    How can I do it?
    Thanks in advanced
    (Office 2003)

    henpat



  2. #2
    Norman Jones
    Guest

    Re: Funtion and Cell

    Hi Henpat,

    Try something like:

    '=================>>
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim rng As Range

    Set rng = Range("B4")
    If Not Intersect(rng, Target) Is Nothing Then
    'Do something, e.g.:
    MsgBox "Hi!"
    'or:
    Call MyMacro
    End If
    End Sub
    '<<================

    This is worksheet event code and should be pasted into the worksheets's
    code module (not a standard module and not the workbook's ThisWorkbook
    module):

    *******************************************
    Right-click the worksheet's tab

    Select 'View Code' from the menu and paste the code.

    Alt-F11 to return to Excel.
    *******************************************

    ---
    Regards,
    Norman



    "henpat" <[email protected]> wrote in message
    news:[email protected]...
    > Good morning/afternoon
    >
    > I need to execute a function only when the cell "B4" change of value.
    > How can I do it?
    > Thanks in advanced
    > (Office 2003)
    >
    > henpat
    >




  3. #3
    Norman Jones
    Guest

    Re: Funtion and Cell

    Hi Henpat,

    > Private Sub Worksheet_SelectionChange(ByVal Target As Range)


    Should be:

    Private Sub Worksheet_Change(ByVal Target As Range)


    ---
    Regards,
    Norman



    "Norman Jones" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Henpat,
    >
    > Try something like:
    >
    > '=================>>
    > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    > Dim rng As Range
    >
    > Set rng = Range("B4")
    > If Not Intersect(rng, Target) Is Nothing Then
    > 'Do something, e.g.:
    > MsgBox "Hi!"
    > 'or:
    > Call MyMacro
    > End If
    > End Sub
    > '<<================
    >
    > This is worksheet event code and should be pasted into the worksheets's
    > code module (not a standard module and not the workbook's ThisWorkbook
    > module):
    >
    > *******************************************
    > Right-click the worksheet's tab
    >
    > Select 'View Code' from the menu and paste the code.
    >
    > Alt-F11 to return to Excel.
    > *******************************************
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "henpat" <[email protected]> wrote in message
    > news:[email protected]...
    >> Good morning/afternoon
    >>
    >> I need to execute a function only when the cell "B4" change of value.
    >> How can I do it?
    >> Thanks in advanced
    >> (Office 2003)
    >>
    >> henpat
    >>

    >
    >




  4. #4
    henpat
    Guest

    Re: Funtion and Cell

    Thanks

    "Norman Jones" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Henpat,
    >
    > Try something like:
    >
    > '=================>>
    > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    > Dim rng As Range
    >
    > Set rng = Range("B4")
    > If Not Intersect(rng, Target) Is Nothing Then
    > 'Do something, e.g.:
    > MsgBox "Hi!"
    > 'or:
    > Call MyMacro
    > End If
    > End Sub
    > '<<================
    >
    > This is worksheet event code and should be pasted into the worksheets's
    > code module (not a standard module and not the workbook's ThisWorkbook
    > module):
    >
    > *******************************************
    > Right-click the worksheet's tab
    >
    > Select 'View Code' from the menu and paste the code.
    >
    > Alt-F11 to return to Excel.
    > *******************************************
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "henpat" <[email protected]> wrote in message
    > news:[email protected]...
    >> Good morning/afternoon
    >>
    >> I need to execute a function only when the cell "B4" change of value.
    >> How can I do it?
    >> Thanks in advanced
    >> (Office 2003)
    >>
    >> henpat
    >>

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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