+ Reply to Thread
Results 1 to 3 of 3

Worksheet_SelectionChange Problem

  1. #1
    Forum Contributor
    Join Date
    01-06-2004
    Location
    Carbondale CO
    Posts
    245

    Worksheet_SelectionChange Problem

    Hi,
    I'm trying to have a reminder message pop up when a certain cell is selected. I would like to do this with VBA as opposed to doing it with a Data Validation input message. I've tried the following code but to no avail. Here's the code followed by the error message.

    Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

    If Target.Row = 5 And Target.Column = 6 Then
    MsgBox = "Have you verified your Extra Material setting in cell A1? Normal setting is 25."
    End If

    End Sub

    I get the following error message:

    ---------------------------
    Microsoft Visual Basic
    ---------------------------
    Compile error:

    Function call on left-hand side of assignment must return Variant or Object
    ---------------------------
    OK Help
    ---------------------------
    Casey

  2. #2
    Bernie Deitrick
    Guest

    Re: Worksheet_SelectionChange Problem

    Casey,

    No equal sign on the MsgBox line:

    Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

    If Target.Row = 5 And Target.Column = 6 Then
    MsgBox "Have you verified your Extra Material setting in cell A1? Normal setting is 25."
    End If

    End Sub

    You can also modify other cells, or check the input value with the change event.

    HTH,
    Bernie
    MS Excel MVP


    "Casey" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi,
    > I'm trying to have a reminder message pop up when a certain cell is
    > selected. I would like to do this with VBA as opposed to doing it with
    > a Data Validation input message. I've tried the following code but to
    > no avail. Here's the code followed by the error message.
    >
    > Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    >
    > If Target.Row = 5 And Target.Column = 6 Then
    > MsgBox = "Have you verified your Extra Material setting in cell
    > A1? Normal setting is 25."
    > End If
    >
    > End Sub
    >
    > I get the following error message:
    >
    > ---------------------------
    > Microsoft Visual Basic
    > ---------------------------
    > Compile error:
    >
    > Function call on left-hand side of assignment must return Variant or
    > Object
    > ---------------------------
    > OK Help
    > ---------------------------
    >
    >
    > --
    > Casey
    >
    >
    > ------------------------------------------------------------------------
    > Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
    > View this thread: http://www.excelforum.com/showthread...hreadid=469251
    >




  3. #3
    Forum Contributor
    Join Date
    01-06-2004
    Location
    Carbondale CO
    Posts
    245
    Bernie,
    Thanks for the help. Worked like a charm. Thanks for the added suggestions as well. I might have some uses for those in some other spreadsheet apps. Thanks again.

+ 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