to all
breaking down some code to small bits for testing. The following is just a dummy code which aim to replicate a more complex vba code
I want to UNION some ranges but it it not recognised - a syntax issue I guess can someone point me in the right direction?
There will be a follow question (already working on it) regarding the most efficient of searching for a number in column zero on my array while looping through a range
breaking down some code to small bits for testing. The following is just a dummy code which aim to replicate a more complex vba code
I want to UNION some ranges but it it not recognised - a syntax issue I guess can someone point me in the right direction?
There will be a follow question (already working on it) regarding the most efficient of searching for a number in column zero on my array while looping through a range
VBA Code:
Dim ifirstrow As Integer, ilastrow As Integer
ifirstrow = 1
ilastrow = 5
Dim rg0 As Range, rg1 As Range, rg2 As Range, rg3 As Range
Dim rgfull As Range
Dim wksheet1 As Worksheet: Set wksheet1 = Worksheets("Sheet1")
Dim wksheet2 As Worksheet: Set wksheet2 = Worksheets("Sheet2")
Dim wksheet3 As Worksheet: Set wksheet3 = Worksheets("Sheet3")
With Application.ActiveWorkbook
With wksheet1 'Worksheets("Sheet1")
Set rg0 = .Range(.Cells(ifirstrow, 1), .Cells(ilastrow, 1))
Set rg1 = .Range(.Cells(ifirstrow, 2), .Cells(ilastrow, 4))
End With
With wksheet2 'Worksheets("Sheet1")
Set rg2 = .Range(.Cells(ifirstrow, 2), .Cells(ilastrow, 4))
End With
With wksheet3 'Worksheets("Sheet3")
Set rg3 = .Range(.Cells(ifirstrow, 2), .Cells(ilastrow, 4))
End With
End With
Set rgfull = Union(rg1, rg2, rg3)
Dim myarray As Variant
myarray = rgfull.Value