Simple VBA function that returns product of range value
问题 I want the function to take a range of cells as an argument and return their product. Let's assume the following value for cells: A1=5 A2=2 A3=3 Let's call the function Multiply . =Multiply(A1:A3) will return 30 (=5×2×3). What is the code for this? I'm just trying to familiarize myself with the syntax and this will help out a lot. Edit: figured it out: Function multiply(rng As Range) multiplied = 1 For Each cell In rng multiplied = multiplied * cell.Value Next multiply = multiplied End