Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
End sub early if mismatch
My code (below) uses a For Each..Next loop with an If section to check if two columns of data match. If there is a mismatch, code displays a message box. I want to add a line that ends the procedure if a mismatch is found. What code would do this? Sub CompareLists() Cells.Find(What:="Open Positions In Current Year").Offset(1).Select Range(Selection, Selection.End(xlDown)).Select Set CurSymbols = Selection Cells.Find(What:="PASymbol").Select Set PASymbol = Selection For Each Sym In CurSymbols If Sym < Cells(Sym.Row, PASymbol.Column) Then MsgBox "Mismatch on " & Sym '*** Add code here to end procedure if there is a mismatch*** End If Next Sym MsgBox "Symbol Lists Match" End Sub Thanks in advance, Alan -- achidsey |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
End sub early if mismatch
Exit Sub
-- Gary''s Student "achidsey" wrote: My code (below) uses a For Each..Next loop with an If section to check if two columns of data match. If there is a mismatch, code displays a message box. I want to add a line that ends the procedure if a mismatch is found. What code would do this? Sub CompareLists() Cells.Find(What:="Open Positions In Current Year").Offset(1).Select Range(Selection, Selection.End(xlDown)).Select Set CurSymbols = Selection Cells.Find(What:="PASymbol").Select Set PASymbol = Selection For Each Sym In CurSymbols If Sym < Cells(Sym.Row, PASymbol.Column) Then MsgBox "Mismatch on " & Sym '*** Add code here to end procedure if there is a mismatch*** End If Next Sym MsgBox "Symbol Lists Match" End Sub Thanks in advance, Alan -- achidsey |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
End sub early if mismatch
Gary''s Student, Simple enough. Thanks -- achidsey "Gary''s Student" wrote: Exit Sub -- Gary''s Student "achidsey" wrote: My code (below) uses a For Each..Next loop with an If section to check if two columns of data match. If there is a mismatch, code displays a message box. I want to add a line that ends the procedure if a mismatch is found. What code would do this? Sub CompareLists() Cells.Find(What:="Open Positions In Current Year").Offset(1).Select Range(Selection, Selection.End(xlDown)).Select Set CurSymbols = Selection Cells.Find(What:="PASymbol").Select Set PASymbol = Selection For Each Sym In CurSymbols If Sym < Cells(Sym.Row, PASymbol.Column) Then MsgBox "Mismatch on " & Sym '*** Add code here to end procedure if there is a mismatch*** End If Next Sym MsgBox "Symbol Lists Match" End Sub Thanks in advance, Alan -- achidsey |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
formula help - avtive early | Excel Worksheet Functions | |||
15 minutes early | Excel Discussion (Misc queries) | |||
Early Login, Last Logout | Excel Worksheet Functions | |||
Macros terminate early | Excel Programming | |||
Loop ends early | Excel Programming |