If and then

Status
Not open for further replies.

joacro

Board Regular
Joined
Jun 24, 2010
Messages
158
Hi there I wonder if anyone can help me with this.

I need VBA code for:

If Range(F2)greater or equal to 90000 and (H2) = 90000 the (J2) ="Gold'
else if (F2) = smaller than 90000 but greater or equl to 70000 and H2 = 90000 the H2 = Silver


Hope this makes sense and that someone can help me

Regards
Joacro
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
try this
Code:
Sub Gold_Silver()
If Range("H2") = 9000 And Range(F2) >= 90000 Then
    Range("J2") = "Gold"
End If
If Range("F2") < 9000 Or Range("F2") >= 7000 And Range("h2") = 90000 Then
    Range("H2") = "Silver"
End If
End Sub
 
Upvote 0
Try

Code:
If Range("F2").Value >= 90000 And Range("H2").Value = 90000 Then
    Range("J2") = "Gold'"
ElseIf Range("F2").Value <= 90000 And Range("F2").Value >= 70000 And Range("H2").Value = 90000 Then
    Range("H2").Value = "Silver"
End If
 
Upvote 0
Hi there guys,

It doesn't seem to work. However F2 is merged From F2 to F5 the same with H and J

Can you please advice accordingly

Regards

Joacro
 
Upvote 0
Hi there Peter,

I have unmerged the cell but is still doesn't seem to work.

I have pasted you code to the vba in the sheet that I want the code to work on.

Any advise?
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,216,030
Messages
6,128,418
Members
449,449
Latest member
Quiet_Nectarine_

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top