Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Below is a sub that I wrote to multiply range "a" and range "b" to get range
"c". Range "a" would be a1:a10, range b would be b1:b10, range "d" would be "c1:c10". It is not working and am getting an "object required" error. I am assuming that the error message refers to darray but is darray not an object? I am writing this code so I could avoid functions in the worksheet where my rows changes often. I don't want to copy and paste the function but just have the excel automatically perform the calculation upon an event change. Also, if you could refer me to a book or website where there is more array examples or information, it would be appreciated. Sub test() Dim myarray As Variant Dim mycount As Integer aarray = Worksheets("sheet1").Range("a") barray = Worksheets("sheet1").Range("b") darray = Worksheets("sheet1").Range("d") For mycount = LBound(aarray) To UBound(aarray) '0 to 3 darray(mycount, 1).Value = WorksheetFunction.Product(aarray(mycount, 1), barray(mycount, 1)) Next mycount End Sub -- Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Prevent cell/array references from changing when altering/moving thecell/array | Excel Discussion (Misc queries) | |||
meaning of : IF(Switch; Average(array A, array B); array A) | Excel Worksheet Functions | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
variant array containing cel adresses convert to actual ranges-array | Excel Programming |