IF using VBA

C

confused

I was wondering if you could help me with a little vba .. I have some code
that populates a summary page .. I am needed to change this part where it's
populating the below code under quantity
.Range("E10") = wsSource.Range("B5")

Somehow I need it to populate .Range("E10") with a number based on another
field

so if wsSource.Range("B6")= "Quarterly in Arrears", .Range("B8"), Else
..Range("B9")

How do I do that? Thanks!
 
O

OssieMac

I am not sure what values you want where but the following is an example of
the If/Then/Else and you can substitue the ranges you require.

If wsSource.Range("B6") = "Quarterly in Arrears" Then
.Range("B8") = wsSource.Range("B5")
Else
.Range("B9") = wsSource.Range("B6")
End If
 
M

Mike H

hi,

You posted to little code to be precise but try this. I don't of course know
what WITH statement you have enclosing this IF statement

If wsSource.Range("B6") = "Quarterly in Arrears" Then
.Range ("B8")
Else
.Range ("B9")
End If

Mike
 
C

confused

Thank you -- what if I want to add a message to another section -- it's
saying if Cell C5 has an amount greater than 13% then show this message at
the bottom of the page.

In
If .Range("C5") = .Value > "13%" Then

With target

"Message:please contact the ABM for the specific extended net list price per
part number."
Else
""
End If
 
O

OssieMac

Need to use the actual numeric value of the percentage. Percentage is only
the method used to display data; not the actual value.

Note that the message line enclosed in the double quotes might break into 2
lines in this post. When you copy it into the VBA editor, if the line is in
red then you will need to edit the line to make it one continuous line.

If .Range("C5") .Value > 0.13 Then
MsgBox "Please contact the ABM for the specific extended net list
price per part number."

End If
 

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