difficulty with logical - if - and

  • Thread starter Thread starter billabong
  • Start date Start date
B

billabong

I'm encountering difficulty with the following in VBA:

Quantity = cell B1
Price = cell B3
Gross amount = cell B5

How can I write the following logical if statement as follows:

If B1 is greater than 1, and B2 is greater than .0001, then (multiply
both together in B5, or else leave blank.

Thank you in advance.
Manuel
 
Hi,

If Range("b2").Value > 1 And Range("b2").Value > 0.0001 Then
Range("b5").Value = Range("b1").Value * Range("b2").Value
End If
 
What's in B2?

I assume you mean B3 when you say B2. Otherwise, replace all the B3 with
B2.

=if(And(B1>1,B3>.0001),B3*B1,"")
 
Hi,

If Range("b2").Value > 1 And Range("b2").Value > 0.0001 Then
Range("b5").Value = Range("b1").Value * Range("b2").Value
End If

Hello:
I've entered the following:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("b2").Value > 1 And Range("b2").Value > 0.0001 Then
Range("b5").Value = Range("b1").Value * Range("b2").Value
End If
End Sub


However nothing appears in cell B5
even though I entered 4 in cell B1 and 1 in cell B2 on the
spreadsheet.

Thank you, Manuel
 
Hi,

If Range("b2").Value > 1 And Range("b2").Value > 0.0001 Then
Range("b5").Value = Range("b1").Value * Range("b2").Value
End If


Please disregard my last posting, it works perfectly, thank you,
I just entered those variables in cells A1 and A2 instead of B1 and
B2. ooops...

Manuel
 
Back
Top