Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default IF using VBA

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!




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default IF using VBA

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

--
Regards,

OssieMac


"confused" wrote:

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!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default IF using VBA

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

"confused" wrote:

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!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default IF using VBA

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







"OssieMac" wrote:

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

--
Regards,

OssieMac


"confused" wrote:

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!




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default IF using VBA

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

--
Regards,

OssieMac


"confused" wrote:

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







"OssieMac" wrote:

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

--
Regards,

OssieMac


"confused" wrote:

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!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"