Link to home
Start Free TrialLog in
Avatar of stormhunter2000
stormhunter2000

asked on

Excel Macro

Hello, I need some help.  I need to create a macro that will run when the project opens up and stays in the background.  I need this macro, to popup a message box stating "Perform a RVR" whenever the user enters a value of 1600 or less on the activerow, in column m26. Another catch is the user might enter 1600 in another active row say m28.  So basically i need it to cover m26,m28,m30 and so on.  
Avatar of wileecoy
wileecoy
Flag of United States of America image

Try this - you will need to adjust the 'Sheet1' and the range.

Enter this into a new module:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim i As Integer
i = 1

For Each c In Worksheets("Sheet1").Range("M1:M50")
    'To only do the even ones.
    If i = 1 Then
        i = i + 1
    Else
        If c.Value > 0 And c.Value < 1601 Then
            MsgBox "Hello - " & c.Value & ", " & c.Cells.Address
        End If
        i = 1
    End If
Next c

End Sub



Now - based on your question, I was given the impression that you only wanted the even ones in Column M ("So basically i need it to cover m26,m28,m30 and so on.").

If this is not the case, simply remove all references to i and the if statement related to i.

hth.

let me know if you have any questions or if I misunderstood the question.

Wileecoy.
ASKER CERTIFIED SOLUTION
Avatar of ture
ture

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stormhunter2000
stormhunter2000

ASKER

THANK YOU IT WORKED!!!
Excel-lent code ture.
:o) I'm glad that you like it. Thanks for the points, stormhunter!

/Ture