View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default multiple if statement

One way. Modify to suit
Sub usearrayforOR()
myarray = Array("a", "b", "c")
For Each x In myarray
'If ActiveCell = x Then MsgBox "delete it"
'yours
If startb.Offset(i, 0)= i Then rows(i+1).Delete
Next
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"sharmashanu" wrote in message
...
Is there a better way to write these statements

Sub usearrayforOR()

myarray = Array("a", "b", "c")
For Each i In myarray
If ActiveCell = i Then MsgBox "delete it"
Next
End Sub
If startb.Offset(i, 0).Value = "AC03" Then startb.Offset(i,
0).EntireRow.Delete
If startb.Offset(i, 0).Value = "AC05" Then startb.Offset(i,
0).EntireRow.Delete
If startb.Offset(i, 0).Value = "AT01" Then startb.Offset(i,
0).EntireRow.Delete
If startb.Offset(i, 0).Value = "CF01" Then startb.Offset(i,
0).EntireRow.Delete
If startb.Offset(i, 0).Value = "CP01" Then startb.Offset(i,
0).EntireRow.Delete
If startb.Offset(i, 0).Value = "DB01" Then startb.Offset(i,
0).EntireRow.Delete
If startb.Offset(i, 0).Value = "DG" Then startb.Offset(i,
0).EntireRow.Delete
If startb.Offset(i, 0).Value = "DSK01" Then startb.Offset(i,
0).EntireRow.Delete
If startb.Offset(i, 0).Value = "FT080" Then startb.Offset(i,
0).EntireRow.Delete

thanks

Shanu