Using .Range(cells()) instead of Range("XY")

pdbowling

Registered User.
Local time
Today, 19:04
Joined
Feb 14, 2003
Messages
179
Hi, everyone.
I'm calling Excel from Access.
Is there a way to convert
.Range("B1:D1,B4:D4").Select
into an Excel function using Cells() instead.

.Range(cells(w, x), cells(y, z))

works for solid ranges but "B1:D1,B4:D4" is selected on non consecutive rows.

.Range(cells(a, b):cells(c,d) , cells(e,f): cells(g,h)) doesn't work.

Any suggestions?
PB
 
A bit of digging around in the Excel help would give you this

Sub MultipleRange()
Dim r1, r2, myMultipleRange As Range
Set r1 = Sheets("Sheet1").Range(Cells(1, 1), Cells(2, 2))
Set r2 = Sheets("Sheet1").Range(Cells(5, 5), Cells(6, 6))
Set myMultipleRange = Union(r1, r2)
myMultipleRange.Select
End Sub
 

Users who are viewing this thread

Back
Top Bottom