ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating a range (https://www.excelbanter.com/excel-programming/288794-creating-range.html)

Bob Phillips[_6_]

Creating a range
 
Marco,

dim r as range
set r = new range

creates a range object, but doesn't actually assign it to a physical range.

so something like

set r = Worksheet("Sheet1").Range("Test")

is required to actually assign a range to the range object, and then
whenever you refer to r it implicitly refers to Test.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Marco Roberto" wrote in message
...
Hi,
is there anyway to create a range in memory like:
dim r as range
set r = new range
or I really need to set a range in a worksheet like:

set r = Worksheet("Sheet1").Range("Test")

Tks,

Marco





Marco Roberto

Creating a range
 
Hi,
is there anyway to create a range in memory like:
dim r as range
set r = new range
or I really need to set a range in a worksheet like:

set r = Worksheet("Sheet1").Range("Test")

Tks,

Marco



Bob Phillips[_6_]

Creating a range
 
Marco,

I don't get it. As I said, in VBA you create a range object, it has to refer
to something otherwise it is null, and you can't do a lot with a null
object.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Marco Roberto" wrote in message
...
Bob,

first of all, thaks for your reply. In fact, I don't want to refer to
Test. I just want to
create the range in memory and perform some operations with this range

like:
input some
values, etc. I will use this range as a parameter to the DSum
worksheetfunction.

Tks

"Bob Phillips" wrote in message
...
Marco,

dim r as range
set r = new range

creates a range object, but doesn't actually assign it to a physical

range.

so something like

set r = Worksheet("Sheet1").Range("Test")

is required to actually assign a range to the range object, and then
whenever you refer to r it implicitly refers to Test.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Marco Roberto" wrote in message
...
Hi,
is there anyway to create a range in memory like:
dim r as range
set r = new range
or I really need to set a range in a worksheet like:

set r = Worksheet("Sheet1").Range("Test")

Tks,

Marco









Marco Roberto

Creating a range
 
Bob,

first of all, thaks for your reply. In fact, I don't want to refer to
Test. I just want to
create the range in memory and perform some operations with this range like:
input some
values, etc. I will use this range as a parameter to the DSum
worksheetfunction.

Tks

"Bob Phillips" wrote in message
...
Marco,

dim r as range
set r = new range

creates a range object, but doesn't actually assign it to a physical

range.

so something like

set r = Worksheet("Sheet1").Range("Test")

is required to actually assign a range to the range object, and then
whenever you refer to r it implicitly refers to Test.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Marco Roberto" wrote in message
...
Hi,
is there anyway to create a range in memory like:
dim r as range
set r = new range
or I really need to set a range in a worksheet like:

set r = Worksheet("Sheet1").Range("Test")

Tks,

Marco








All times are GMT +1. The time now is 12:31 PM.

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