ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range question (https://www.excelbanter.com/excel-programming/299460-range-question.html)

Lee Dengo

Range question
 
Hi there,
I'd like to seperate a range to n different ranges then
pass these ranges as parameters to a function in Visual
Basic separately.
I use:
Set myRange = Excel.Range(OldRange(1, 1), OldRange(99, 1))
to make a new range "myRange", which has the first 100
value in old range "OldRange"

It works fine in VBA, but in VB it is failed.

Any suggestions? Thanks,

Lee

Juan Pablo González

Range question
 
Try using

Set myRange = OldRange(1, 1).Resize(100)

--
Regards

Juan Pablo González

"Lee dengo" wrote in message
...
Hi there,
I'd like to seperate a range to n different ranges then
pass these ranges as parameters to a function in Visual
Basic separately.
I use:
Set myRange = Excel.Range(OldRange(1, 1), OldRange(99, 1))
to make a new range "myRange", which has the first 100
value in old range "OldRange"

It works fine in VBA, but in VB it is failed.

Any suggestions? Thanks,

Lee




Bob Flanagan

Range question
 
use

Set myRange = Excel.Range(Cells(1, 1), Cells(99, 1))

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"Lee dengo" wrote in message
...
Hi there,
I'd like to seperate a range to n different ranges then
pass these ranges as parameters to a function in Visual
Basic separately.
I use:
Set myRange = Excel.Range(OldRange(1, 1), OldRange(99, 1))
to make a new range "myRange", which has the first 100
value in old range "OldRange"

It works fine in VBA, but in VB it is failed.

Any suggestions? Thanks,

Lee





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

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