why do i get "range out of bounds"

blw2002

New Member
Joined
Jul 23, 2012
Messages
3
why do i get "range out of bounds" for v(i) = x(i) * y(i)?


Function element_mul(x, y)
Dim i As Long
Dim v()

ReDim v(1 To size(x))
For i = LBound(x) To UBound(x)

**v(i) = x(i) * y(i)**
Next

element_mul = v
End Function

Sub main_ols()
Dim x, y, z,
Dim strMsg As String
Dim rng1 As Range
Dim rng2 As Range
Dim lngRow As Long

Set rng1 = Range([B3], [B52])
Set rng2 = Range([C3], [C52])

x = RangeToArray(rng1)
y = RangeToArray(rng2)

For lngRow = 1 To UBound(x)
x(lngRow, 1) = UCase$(x(lngRow, 1))
y(lngRow, 1) = UCase$(y(lngRow, 1))
Next
rng1 = x
rng2 = y


z = regress_orthols(x, y)
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,215,453
Messages
6,124,920
Members
449,195
Latest member
Stevenciu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top