Results 1 to 3 of 3

worksheet change code not working

Threaded View

  1. #1
    Registered User
    Join Date
    06-20-2008
    Posts
    3

    worksheet change code not working

    Hello Nadie, welcome to the forum.

    Please take the trouble to read the forum rules, and note the one which asks posters to wrap VBA code in code tags.

    I've edited the code on this occasion for you.

    Regards


    Hello all,

    I'm relatively new to macros, so my apologies if this is beyond basic. I had this working at one point, to my delight! but then I changed something and made an infinite loop and had to quit and now nothing is happening, sadly.

    I want a message box to pop up when there is numerical input into cell Q9 of either less than 500 or less than 1000. If the cell is less than 500, I want the cell to revert to blank.

    I'm still working on how to make the cell font colour red if the value is between 500 and 1000 using a macro rather than conditional formatting.

    Thanks so much for your help!

    Nadie
    Here is my code:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Application.Intersect(Target, Range("Q9")) Is Nothing Then
        If IsNumeric(Target) Then
        
            Application.EnableEvents = True
            Select Case Target
                Case Is < 500
                
                MsgBox ("  Impossible. Over 1000 is recommended.  ")
                Target = " "
                Case Is < 1000
                MsgBox ("  Over 1000 is recommended.  ")
    
            End Select
            
        
        End If
    End If
    End Sub
    Last edited by Richard Buttrey; 06-24-2008 at 12:45 PM. Reason: Code tags missing from code section of post.

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