ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   looping through an array of ranges (https://www.excelbanter.com/excel-programming/373921-looping-through-array-ranges.html)

Arnold Klapheck

looping through an array of ranges
 
I am trying this code but am getting message, "can't assign to array" and the
RangeVY is highlighted (see after @) any help on looping through many arrays
would be appreciated. thanx

' I also tried Dim RangeVY As varient but got user defined type not
defined

Dim RangeVY(3) As Range
@RangeVY = Array("V2", "W2", "X2", "Y2")

For i = LBound(RangeVY) To UBound(RangeVY)
Do Until ActiveCell.Offset(0, 0) = ""
Call DR6_Variances_Calculations_Subroutine_1
Loop

Sub DR6_Variances_Calculations_Subroutine_1()

ActiveCell.FormulaR1C1 = "=ROUND(RC[-10]-RC[-5],2)"
ActiveCell.Offset(1, 0).Select

End Sub

Trevor Shuttleworth

looping through an array of ranges
 
Try:

Dim RangeVY()
RangeVY = Array("V2", "W2", "X2", "Y2")

Regards

Trevor


"Arnold Klapheck" wrote in
message ...
I am trying this code but am getting message, "can't assign to array" and
the
RangeVY is highlighted (see after @) any help on looping through many
arrays
would be appreciated. thanx

' I also tried Dim RangeVY As varient but got user defined type not
defined

Dim RangeVY(3) As Range
@RangeVY = Array("V2", "W2", "X2", "Y2")

For i = LBound(RangeVY) To UBound(RangeVY)
Do Until ActiveCell.Offset(0, 0) = ""
Call DR6_Variances_Calculations_Subroutine_1
Loop

Sub DR6_Variances_Calculations_Subroutine_1()

ActiveCell.FormulaR1C1 = "=ROUND(RC[-10]-RC[-5],2)"
ActiveCell.Offset(1, 0).Select

End Sub





All times are GMT +1. The time now is 01:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com