Currently I am using Excel 2010. So we are going to create simple macros here.
What is Macro ?
A very simple answer is,
Through macros you don’t need to perform same task or action on same type of data. Macros are the built-in feature of Excel that enables user to record different tasks and apply them over on some another portion of the data. It works on the back-end, recording each and every mouse click, keystrokes that you do while performing the task. Down the line if you want to done with the task in a same way, you will just have to play the recorded Macro back.
Suppose I have a worksheet in excel and I want to display product "Grade" and "Remark" according to product "Quality" column. If product quality greater than or equal to 70 then Grade should be "A" and Remark should be "Better" automatically, as smart macros fired in background.

Exploring step by step :
Step1 : Go to Start -> Microsoft Excel 2010 , blank worksheet will be open for you.
Step2 : Click on View -> Micros , See below image

Step3 : Click on Record Macros, pop up window will be open, you can set your macro name,
shortcut key , store macro in dropdown option and description and click Ok. See below image
Step4 : Now set fx function on Grade column as =IF(B2>=70,"A","B") and set Remark column as
=IF(C2="A","Better","Average").
Step5 : Click on IF function and click OK button to set condition for Grade column , See below Image.
Step5 : Click on IF function and click OK button to set condition for Remark column , See below Image.
Save Excel file Type as Excel - Macro Enabled Workbook (*.xlsm).
Step6 : Get Grade and Remark column value by giving input to Quality column through UI.
-> Go to Start open Microsoft Visual Studio 2010.
-> Click on New Project you can choose Windows Or Web base application. I am exploring with windows base. See below Image :
Step7 : Go to Solution Explorer -> Right Click On References -> Add Microsoft Excel Lib reference from COM, See below Image :
Step8 : Adding Dropdown list (selecting input for Excel) , and two Text Boxes (to getting output from Grade and Remark column from Excel) See below Form1 Image :
Step8 : Adding Dropdown list collection value.
Right click on DropdownList -> Click on Properties -> Items property and add Items as,
See below Image :
Step8 : Double click on Dropdownlist. Add below code to Dropdown selected index changed event.
Run The Application and select Input value from Dropdownlist you will get output at Grade and Remark column from excel. Also open an excel to see all values are getting reflect.
Copy Full Code :
What is Macro ?
A very simple answer is,
Through macros you don’t need to perform same task or action on same type of data. Macros are the built-in feature of Excel that enables user to record different tasks and apply them over on some another portion of the data. It works on the back-end, recording each and every mouse click, keystrokes that you do while performing the task. Down the line if you want to done with the task in a same way, you will just have to play the recorded Macro back.
Suppose I have a worksheet in excel and I want to display product "Grade" and "Remark" according to product "Quality" column. If product quality greater than or equal to 70 then Grade should be "A" and Remark should be "Better" automatically, as smart macros fired in background.

Exploring step by step :
Step1 : Go to Start -> Microsoft Excel 2010 , blank worksheet will be open for you.
Step2 : Click on View -> Micros , See below image

Step3 : Click on Record Macros, pop up window will be open, you can set your macro name,
shortcut key , store macro in dropdown option and description and click Ok. See below image
=IF(C2="A","Better","Average").
Step6 : Get Grade and Remark column value by giving input to Quality column through UI.
-> Go to Start open Microsoft Visual Studio 2010.
-> Click on New Project you can choose Windows Or Web base application. I am exploring with windows base. See below Image :
Right click on DropdownList -> Click on Properties -> Items property and add Items as,
See below Image :
Code:
Run The Application and select Input value from Dropdownlist you will get output at Grade and Remark column from excel. Also open an excel to see all values are getting reflect.
Copy Full Code :














