This document provides instructions for accessing Visual Basic Editor in Microsoft Excel to write macros. It explains that in older Excel versions, users can access VBE by going to Tools > Macro > Visual Basic Editor, while in Excel 2007 they select the Windows icon and Excel Options to show the Developer tab where VBE is launched. It also outlines how to interface with Excel worksheets from VBA, such as declaring worksheet variables, setting worksheets, referring to cell values and writing values to cells using row and column numbers.
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
398 views
Visual Basic For Applications
This document provides instructions for accessing Visual Basic Editor in Microsoft Excel to write macros. It explains that in older Excel versions, users can access VBE by going to Tools > Macro > Visual Basic Editor, while in Excel 2007 they select the Windows icon and Excel Options to show the Developer tab where VBE is launched. It also outlines how to interface with Excel worksheets from VBA, such as declaring worksheet variables, setting worksheets, referring to cell values and writing values to cells using row and column numbers.
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1
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)