Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Change value cell If/then

0

I have cell D6 where I can enter values from 500 and increasing by 50. In cell G9 the value of cell D6 + 52 + 10 comes.

Now I would like that if the value in cell D6 is less than 600 that cell G9 automatically gets a value of 700. I had created a program code but that does not seem that easy.

Sub Upper bar ()

If D6 <650 Then

G9 = 700

End If

End Sub

Answer
Discuss

Answers

0
Selected Answer

put their formula in G9

=IF(D6<600,700,D6+62)
Discuss

Discussion

Thanks
But i get an error that something is wrong. From 600 to D6 gets highlighted.
Heruvent (rep: 2) Aug 7, '19 at 1:20 am
I found the problem, i have to use ; instead of ,
Heruvent (rep: 2) Aug 7, '19 at 1:36 am
I'm confused, where do you use the semi-colon? Commas should work to separate the arguments in the IF function.
don (rep: 1989) Aug 7, '19 at 3:47 pm
Whether you have to use comma or semi-colon depends on the language version of youdr Excel
bob45 Aug 9, '19 at 5:19 am
Ohh, interesting, I didn't know that. Thanks!
don (rep: 1989) Aug 13, '19 at 10:38 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login