Visual Basic for Applications Accessing Visual Basic Editor in MS Excel: • Tools • Macro • Visual Basic Editor Accessing Visual Basic Editor in MS Excel 2007: • Select Windows icon • Select Excel options • Show Developer Tab in the Ribbon Interfacing with the spreadsheet: • • • •
Declare a variable to identify the worksheet Dim wkTill as Worksheet Set the worksheet Set wkTill = ThisWorkbook.Worksheets(1) Refer to cells in the worksheet (eg: store a cell’s value in a variable) ldblCost.Caption = wkTill.cells(lintRow, lintCol).Value Write in a cell wkTill.cells(lintRow, lintCol).Value = lblTotalCost where lintRow is the row number and lintCol is the column number (eg: B3 would be lintRow = 3, lintCol = 2)