Simple MSG BOX Help

vinothsudar

Board Regular
Joined
Jun 10, 2009
Messages
171
Hi all,

I have values in Column D : D 20,000.

This column values shold be " Chennai or Delhi or Madurai"

If data not found i need a msgbox "Invalid City"

Please help on that.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Can you use another column?

Say E1=if(or(D1="Chenai",D1="Dehli",D1="Madurai")=true,"","Invalid City")
Then copy down all of your data and this will highlight the problematic rows (You could filter on this also.
 
Upvote 0
hey look at the following code

Code:
Sub validate()

Dim i As Integer, j As Integer, s As String
Dim lr As Integer
lr = ActiveSheet.UsedRange.Rows.Count
For i = 1 To lr
    s = Range("D" & i).Value
    If s <> "chennai" And s <> "madhurai" And s <> "delhi" Then
    Range("E" & i).Value = s
   
    End If
    Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,853
Members
449,194
Latest member
HellScout

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