Turn Vba Code into excel Add-in
Find specific in all Worksheet
An Excel Add-In is a file (usually with an .xlam, .xla extension) that Excel can load when it starts up. The file contains
code (VBA in the case of an .xla/.Xlam Add-In) that adds additional functionality to Excel, usually in the form of new functions.
You can say it's a modified version of UDF which can be used across all worksheets.
How to crete an Add-In:
1.Open an excel file with normal VBA code which you want to convert an Add-In
2.Open Project properties Under General tab give a new name to the project.Under Protection tab, lock the project with new
password.
3.In Save as Type drop-down list,select Excel Add-In(*.xlam/*.xla).
4.Click Save
A new Add-In file is created.
Installing Add-In
1. Press Alt TI in already opened excel file
2. Click Browse button and locate the Add-In file just created.
3. After adding new Add-In in its list,click the check button of respective Add-In; it will be added in Add-In's list.
4. Don't save opened file.
5. Restart Excel
To distribute Add-In you just distribute the (*.Xlam/*.xla) file to respective user.
VBA code for calculating Age:
Function calcAge(dob As Date)
If dob = 0 Then
MsgBox "No Birthdate"
Else
Select Case Month(Date)
Case Is < Month(dob)
clacAge = Year(Date) - Year(dob) - 1
Case Is = Month(dob)
If Day(Date) >= Day(dob) Then
calcAge = Year(Date) - Year(dob)
Else
calcAge = Year(Date) - Year(dob) - 1
End If
Case Is > Month(dob)
calcAge = Year(Date) - Year(dob)
End Select
End If
End Function
Find specific in all Worksheet
An Excel Add-In is a file (usually with an .xlam, .xla extension) that Excel can load when it starts up. The file contains
code (VBA in the case of an .xla/.Xlam Add-In) that adds additional functionality to Excel, usually in the form of new functions.
You can say it's a modified version of UDF which can be used across all worksheets.
How to crete an Add-In:
1.Open an excel file with normal VBA code which you want to convert an Add-In
2.Open Project properties Under General tab give a new name to the project.Under Protection tab, lock the project with new
password.
3.In Save as Type drop-down list,select Excel Add-In(*.xlam/*.xla).
4.Click Save
A new Add-In file is created.
Installing Add-In
1. Press Alt TI in already opened excel file
2. Click Browse button and locate the Add-In file just created.
3. After adding new Add-In in its list,click the check button of respective Add-In; it will be added in Add-In's list.
4. Don't save opened file.
5. Restart Excel
To distribute Add-In you just distribute the (*.Xlam/*.xla) file to respective user.
VBA code for calculating Age:
Function calcAge(dob As Date)
If dob = 0 Then
MsgBox "No Birthdate"
Else
Select Case Month(Date)
Case Is < Month(dob)
clacAge = Year(Date) - Year(dob) - 1
Case Is = Month(dob)
If Day(Date) >= Day(dob) Then
calcAge = Year(Date) - Year(dob)
Else
calcAge = Year(Date) - Year(dob) - 1
End If
Case Is > Month(dob)
calcAge = Year(Date) - Year(dob)
End Select
End If
End Function
No comments:
Post a Comment