Arrays/Ranges

theeeeebenedikt

New Member
Joined
Mar 10, 2014
Messages
2
Hi All,

I'm looking to find out if/how i can create a VBA array using ranges i have already set using Dim **** As Range, multiplying the cells down the range.

the 'base' formula i want to use is: =(( (value in range 1)/3600)*(value in range 2))/(value in range 3*1000)

where ranges 1, 2 and 3 are ranges i have just set, as above.

hopefully that makes a bit of sense...

cheers,

Ben
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
One way would be to use the Offset property of the Range. For example:

Code:
Sub my_offset()
    For i = 0 To 9
        With Sheet2
            .Range("A1").offset(i, 0) = .Range("B10").offset(i, 0) / 3600 * .Range("D97").offset(i, 0) * .Range("Z136").offset(i, 0) * 1000
        End With
    Next
End Sub
 
Upvote 0
Assuming that all Ranges are the same size, and named Range1, Range2 and Range3, you could use;

Code:
For i = 1 To Range1.Rows.Count
    Range1.Cells(i, 1).Value = (Range1.Cells(i, 1).Value / 3600) * (Range2.Cells(i, 1).Value / (Range3.Cells(i, 1).Value * 1000))
Next i

Note that since the Sheet isn't specifically referenced it works on the ActiveSheet.
 
Upvote 0
bang on Teeroy, had to tweak my pre-conditioning ranges a bit but that was the missing link pal cheers!!

ps up the mighty maroons ;)
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,760
Members
449,095
Latest member
m_smith_solihull

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