Problem with array and msgbox
Code: -------------------- Sub errorsandproblems() For i = 14 To 156 If Worksheets("user editable sheet 1").Range("e" & i) = "<ERROR" Then MsgBox "It appears that you are dumb, go back and fix it" Else End If Next End Sub -------------------- If this statement comes across multiple errors between cells 14 to 156 column e, then ONLY one msgbox is to be displayed. How can i do this? Antonio -- aking1987 ------------------------------------------------------------------------ aking1987's Profile: http://www.excelforum.com/member.php...o&userid=15393 View this thread: http://www.excelforum.com/showthread...hreadid=273309 |
Antonio,
Sub FixedProblem() If Application.WorksheetFunction.CountIf(Range("E14:E 156"), "<ERROR") 1 Then MsgBox "It appears that you are dumb, go back and fix it" End If End Sub HTH, Bernie MS Excel MVP "aking1987" wrote in message ... Code: -------------------- Sub errorsandproblems() For i = 14 To 156 If Worksheets("user editable sheet 1").Range("e" & i) = "<ERROR" Then MsgBox "It appears that you are dumb, go back and fix it" Else End If Next End Sub -------------------- If this statement comes across multiple errors between cells 14 to 156 column e, then ONLY one msgbox is to be displayed. How can i do this? Antonio -- aking1987 ------------------------------------------------------------------------ aking1987's Profile: http://www.excelforum.com/member.php...o&userid=15393 View this thread: http://www.excelforum.com/showthread...hreadid=273309 |
arrrrrggh, crappy line wrap. The "Then" should be at the end of the long
line.... Sorry Bernie MS Excel MVP "Bernie Deitrick" <deitbe @ consumer dot org wrote in message ... Antonio, Sub FixedProblem() If Application.WorksheetFunction.CountIf(Range("E14:E 156"), "<ERROR") 1 Then MsgBox "It appears that you are dumb, go back and fix it" End If End Sub HTH, Bernie MS Excel MVP "aking1987" wrote in message ... Code: -------------------- Sub errorsandproblems() For i = 14 To 156 If Worksheets("user editable sheet 1").Range("e" & i) = "<ERROR" Then MsgBox "It appears that you are dumb, go back and fix it" Else End If Next End Sub -------------------- If this statement comes across multiple errors between cells 14 to 156 column e, then ONLY one msgbox is to be displayed. How can i do this? Antonio -- aking1987 ------------------------------------------------------------------------ aking1987's Profile: http://www.excelforum.com/member.php...o&userid=15393 View this thread: http://www.excelforum.com/showthread...hreadid=273309 |
All times are GMT +1. The time now is 05:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com