multiple if statement

  • Thread starter Thread starter sharmashanu
  • Start date Start date
S

sharmashanu

Is there a better way to write these statements

If startb.Offset(i, 0).Value = "AC01" Then startb.Offset(i,
0).EntireRow.Delete
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
 
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
(e-mail address removed)
sharmashanu said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top