Some of the useful functions are available in Excel which can be used for writing Macro in Excel. Here in this article I will be discussing about some of the useful functions.
Microsoft Excel is very powerful software used for reporting as well as for data management. There are so many useful commands available in Excel which can be run using the Excel GUI and same kinds of commands we can also run in macro through VBScript.
In this article we will be discussing about some of the useful functions which we can use in Excel Macro. If you would like to know basics of Macro, you can visit Basics of Microsoft Excel Macro and Some useful Tips.
These are the two functions which we can use when we want to do some setting or want to hide some of the sheets before close or after opening the Excel sheet.
Workbook_BeforeClose()
Workbook_Open()
When we open Excel file and if it has having many sheets available. Now if we want to activate or select any particular sheet immediately after opening the Excel then we can use below functions.
Sheets(1). Select - (Below line of code will select first sheet from the available sheets).
Number 1 indicates the sheet number. If we want to select sheet which is available at second position then you can specify 2 in place of 1 like below.
Sheets(2).Select
When we want to perform any action on Worksheet change then below function will help you.
Private Sub Worksheet_Change(ByVal Target As Range)
Read more...