Use VBA for "If" & "And" condition

0

Hi,

I have data of car models, base on Make,model and varient I have to put a data against the row. There are multipule Senerios i.e

If column

B=Maruti and

C=Dezire and

D=Petrol then

E=100

or

If column

B=Maruti and

C=Alto and

D=Petrol then

E=50

so on...

I need VBA to resolve my problem as there are around 30 to 40 parameters.

Your help will be appriciated.

Regards,

Amit Jain

Answer
Discuss

Discussion

Is this a classroom task?
Obviously, no solution can be offered unless all conditions and all expected resuls are known, and no VBA can be designed before it is known where the data are and where the result is needed. The best way to provide that information is by posting your workbook. You can attach it to your original question.
Variatus (rep: 1413) Nov 9, '17 at 9:11 pm
Add to Discussion

Answers

0

These 3 tutorials from us will solve your issue:

VBA IF Statement in Excel Macros

VBA Comparison Operators

Logical Operators in Excel VBA Macros

If you had done a quick search on this site or looked at the macro tutorials, you would have found these and they would have, most likely, given you all the information you need to solve the problem.

Update

Introduction to Programming Macros in Excel

Discuss

Discussion

Hi,

Appriciate your help, but I am a bignner in VBA, not have much knowledge on VBA. Kindly suggest how to write a macro for one condition.

REgards,
Amit Jain
AmitJain Nov 13, '17 at 4:07 am
Did you read any of those tutorials? They are step-by-step and come with sample files.

The only additional information you might need is how to get to where you insert the macro and how to run it.

Alt+F11 > in the window that opens, look to the top menu and go to Insert > Module > put your code in the window that opens.

To run the macro, go back to the Excel widnow and hit Alt+F8 and select the macro and hit Run.
don (rep: 1382) Nov 13, '17 at 5:30 am
Add to Discussion

Answer the Question

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