MetLife

Active Member
Joined
Jul 2, 2012
Messages
283
Hi,

I have some code to output arrays. But the problem is that when the column changes I need to update all the code.

My question - is there some way to re-write this so that I can use offset and only update a single line of code?

Range("BO39:BO116").Value = Application.Transpose(aa)
Range("BP39:BP116").Value = Application.Transpose(cc)
Range("BQ39:BQ116").Value = Application.Transpose(dd)
Range("BR39:BR116").Value = Application.Transpose(ee)
Range("BS39:BS116").Value = Application.Transpose(ff)
Range("BT39:BT116").Value = Application.Transpose(gg)
Range("BU39:BU116").Value = Application.Transpose(hh)
Range("BV39:BV116").Value = Application.Transpose(x)
Range("BW39:BW116").Value = Application.Transpose(ii)
Range("BX39:BX116").Value = Application.Transpose(tt)
Range("BY39:BY116").Value = Application.Transpose(jj)
Range("BZ39:BZ116").Value = Application.Transpose(ss)
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Untested, but maybe something like
Code:
Dim Rng As Range
Dim i As Long
Dim ary As Variant
ary = Array(aa, cc, dd)
Set Rng = Range("BO39:BO116").Value
For i = 0 To 11
   Rng.Offset(, 0).Value = Application.Transpose(ary(i))
Next i
 
Upvote 0
I'm getting the error - object required? run-time error 424?

when it tries to execute:
Set Rng = Range("BO39:BO116").Value
 
Last edited:
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,948
Messages
6,122,420
Members
449,083
Latest member
Ava19

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