Lecture-13(input-output file)

Lecture-13(input-output file) - Getting data into a VBA...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Getting data into a VBA program Lecture-26
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Passing Data to a Function Can come from cells in a worksheet Be read from an external file Be computed by calculations within a function Using spreadsheet values in a function Passed through a parameter list Directly access a cell’s content from a VBA function Passed through a parameter list: =IdealVol(B6,B3,B5) or alternatively =IdealVol(1,1,408) If values are changed at these references, the function returns a new value Values changed in spreadsheet will not return a new value
Background image of page 2
When you pass data using the list, what is actually being transmitted to the function is the memory address of the variable in the list. The function then retrieves the data from that location when needed, modifies the value stored in memory. Data is thus passed By Reference to the function. This is the default in VBA. Instead of passing the memory address, you can directly pass a value by declaring the argument to be ByVal:
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

Lecture-13(input-output file) - Getting data into a VBA...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online