Check for "x" and return notification of where "x" was found

pgrad

Board Regular
Joined
Dec 8, 2010
Messages
60
Hi All,

I would like to write some VBA to check a column of 2000 rows for the number 3.

If 3 is found then I would like a msg box to appear telling the user what row it is on and selecting that row.

If more than one instance of 3 is found then I would like this to repeat or loop until all corrections have been made.

So far all I have is:

Code:
If Range("AO9:AO2031") = 3 Then
            MsgBox " Please ensure you have no incomplete rows"
            Else

Any help or alternative soloutions much appreciated

Thanks
Paul
 
Yeah - You missed out the label :P LOL

Rich (BB code):
'This will check the figures in column AP, if any are equal to or greater than 0 it will return an error msg informing which row contains a value of three
                For i = 9 To 231
                If Cells(i, "AP").Value = "Monday" Then GoTo Skip
                If Cells(i, "AP").Value = "Tuesday" Then GoTo Skip
                If Cells(i, "AP").Value = "Wednesday" Then GoTo Skip
                If Cells(i, "AP").Value = "Thursday" Then GoTo Skip
                If Cells(i, "AP").Value = "Friday" Then GoTo Skip
                If Cells(i, "AP").Value = "Saturday" Then GoTo Skip
                If Cells(i, "AP").Value = "Sunday" Then GoTo Skip
                If Cells(i, "AP").Value <> 0 Then
                MsgBox "Please ensure you have no incomplete rows, check Row " & i
        
                Calculate
                Exit Sub
        
                End If
Skip:

Next i

:)
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top