Hello. Hopefully this is an easy question to answer. I am attempting to write the results of an index function performed on an array to another array. I am using the following:
Sub testRmvDupe()
Dim wsUn As Worksheet
Set wsUn = Sheet1
Dim unLastRow As Long
Dim rngUn As Range
Dim arrUn As Variant
Dim var As Variant
Dim unRowsStr As String
Dim test As Integer
test = 10
With wsUn
unLastRow = .Range("a1").CurrentRegion.Rows.Count
arrUn = .Range("a2", .Range("i" & unLastRow))
var = Application.Index(arrUn, [row(1:10)], Array(2, 1))
End With
End Sub
works as expected. If instead, I substitute the "test" variable for "10" in "[row(1:10)]," I receive Error 2015. Is there a way to use a variable in place of a constant here? I am trying to write certain columns to the array, and the number of rows changes constantly.
Thanks,
Mayday
Bookmarks