Lesson#146: How to make a simple function in VBA | How to add custom formula in Excel

Hello Guys! After a long time, I returned with a new lesson. Today I am going to discuss with you how to make a simple function in VBA. The VBA editor opens huge possibilities to make our Excel sheets into a masterpiece. Here we can make functions as per our needs that are not present in our Excel inbuilt functions. No more talking…
Now we start to make a simple function in VBA. The function is to find out the unit weight (Kg/meter) of the reinforcement bar used for construction works.
- Open the VBA Editor by pressing alt +F11
- Now insert a module.
- Now we will write the function in this way.
Function REINWEIGHT(DIA As Variant) As Variant
REINWEIGHT = (DIA * DIA) / 162.2
End Function
- Now click on Run.
- Create a function and give a name.
Now the function will look like this and work this way. That is how to make a simple function in VBA.


Click Here for more posts for VBA and Macro.
Leave a Reply