Or in VBA

R

Ross

That code doesn't work clearly! i used this


IBC = 0
If Worksheets("1").Cells(acrow, 4).Value = "IBC" Then
IBC = 1
Else
If Worksheets("1").Cells(acrow, 4).Value = "IB2" Then
IBC = 1
End If
End If

Thanks ross
 
K

Kim Mitchell

If you are trying for literal "IB2" and "IBC", your first attempt should
have read:

If Worksheets("1").Cells(acrow, 4).Value = "IB2" Or
Worksheets("1").Cells(acrow, 4).Value = "IBC" Then

If you are looking for variables, it should read:

If Worksheets("1").Cells(acrow, 4).Value = IB2 Or
Worksheets("1").Cells(acrow, 4).Value = IBC Then

Your second try could be more efficiently expressed as:

IBC = 0
If Worksheets("1").Cells(acrow, 4).Value = "IBC" Then
IBC = 1
ElseIf Worksheets("1").Cells(acrow, 4).Value = "IB2" Then
IBC = 1
End If

Kim
 
R

ross

Thanks Kim
-----Original Message-----
If you are trying for literal "IB2" and "IBC", your first attempt should
have read:

If Worksheets("1").Cells(acrow, 4).Value = "IB2" Or
Worksheets("1").Cells(acrow, 4).Value = "IBC" Then

If you are looking for variables, it should read:

If Worksheets("1").Cells(acrow, 4).Value = IB2 Or
Worksheets("1").Cells(acrow, 4).Value = IBC Then

Your second try could be more efficiently expressed as:

IBC = 0
If Worksheets("1").Cells(acrow, 4).Value = "IBC" Then
IBC = 1
ElseIf Worksheets("1").Cells(acrow, 4).Value = "IB2" Then
IBC = 1
End If

Kim




.
 

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

Top