Or in VBA

  • Thread starter Thread starter Ross
  • Start date Start date
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
 
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
 
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




.
 
Back
Top