VBA - Visual Basic for Applications

If you search a value in a column in Excel the following method will be of use.

Source Code

If you have to delete a worksheet from a workbook, you can use below source code.

Source Code

1
2
3
4
5
6
7
8
9
10
' @Author - Alexander Bolte
' @ChangeDate - 2014-10-08
' @Description - Deleting a worksheet named like sheetName from given target Workbook, if a worksheet under given sheetName exists.
' @Param trg - an initialized workbook object.
' @Param sheetName - a String holding a unique worksheet name.
Public Function deleteWorksheet(ByRef trg As Workbook, ByVal sheetName As String)
    If worksheetExists(trg, sheetName) Then
        Call trg.Worksheets(sheetName).Delete
    End If
End Function

Referenced Functions

The following functions are referenced.

 Check if a worksheet exists

 

If you have to determine the total count of records in a Recordset, you can use the RecordCount property.

But first you have to move to the last record in the Recordset by using the MoveLast method.

Source Code

1
2
3
4
src.MoveLast
src.MoveFirst
 
src.RecordCount

Subcategories

This category will hold articles regarding developement in Excel VBA. It will serve as a wiki and an Excel VBA Framework for myself.

Some development tasks reoccur for every customer. Since I am a lazy bum it will be nice to have a central source where I can reuse source code from.

This category holds articles regarding general things in MS Office VBA independent from the MS Office application.  

This category holds articles regarding Access VBA, but also general things I come accross Access and its usage in companies.