ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create Array From Values in range (https://www.excelbanter.com/excel-programming/292858-create-array-values-range.html)

Tony Di Stasi[_2_]

Create Array From Values in range
 
trying to creat a variant with the values in Range(Cells
(1), Cells(1, 9) so that I can run throught another range
and flage matches. Can't seem to get the variant to
work. Thanks!!!

Dim vAGYBOOKS As Variant
Dim vGOVBOOKS As Variant
Dim vGRRBOOKS As Variant
Dim i As Integer
Dim r As Integer


cGOVBOOKS = Array(Range(Cells(1), Cells(1, 9)))

For i = r To 1 Step -1
Debug.Print Cells(i, 4).Formula
If Not IsError(Application.Match(Cells(i,
4).Formula, cGOVBOOKS, 0)) Then
Cells(i, 3) = "GOVTS"
End If
Next i


End Sub

Alan Beban[_4_]

Create Array From Values in range
 
You declared vGOVBOOKS and use cGOVBOOKS. Assuming you declare
cGOVBOOKS, change

cGOVBOOKS = Array(Range(Cells(1), Cells(1, 9)))

to

cGOVBOOKS = Range(Cells(1), Cells(1, 9))

I didn't consider the loop.

Alan Beban

Tony Di Stasi wrote:
trying to creat a variant with the values in Range(Cells
(1), Cells(1, 9) so that I can run throught another range
and flage matches. Can't seem to get the variant to
work. Thanks!!!

Dim vAGYBOOKS As Variant
Dim vGOVBOOKS As Variant
Dim vGRRBOOKS As Variant
Dim i As Integer
Dim r As Integer


cGOVBOOKS = Array(Range(Cells(1), Cells(1, 9)))

For i = r To 1 Step -1
Debug.Print Cells(i, 4).Formula
If Not IsError(Application.Match(Cells(i,
4).Formula, cGOVBOOKS, 0)) Then
Cells(i, 3) = "GOVTS"
End If
Next i


End Sub



Tony D[_3_]

Create Array From Values in range
 
Thanks!!! Simple typo
-----Original Message-----
You declared vGOVBOOKS and use cGOVBOOKS. Assuming you

declare
cGOVBOOKS, change

cGOVBOOKS = Array(Range(Cells(1), Cells(1, 9)))

to

cGOVBOOKS = Range(Cells(1), Cells(1, 9))

I didn't consider the loop.

Alan Beban

Tony Di Stasi wrote:
trying to creat a variant with the values in Range(Cells
(1), Cells(1, 9) so that I can run throught another

range
and flage matches. Can't seem to get the variant to
work. Thanks!!!

Dim vAGYBOOKS As Variant
Dim vGOVBOOKS As Variant
Dim vGRRBOOKS As Variant
Dim i As Integer
Dim r As Integer


cGOVBOOKS = Array(Range(Cells(1), Cells(9, 1)))

For i = r To 1 Step -1
Debug.Print Cells(i, 4).Formula
If Not IsError(Application.Match(Cells(i,
4).Formula, cGOVBOOKS, 0)) Then
Cells(i, 3) = "GOVTS"
End If
Next i


End Sub


.



All times are GMT +1. The time now is 10:53 AM.

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