ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can't create a new instance of the Range class (https://www.excelbanter.com/excel-programming/443971-cant-create-new-instance-range-class.html)

deltaquattro

Can't create a new instance of the Range class
 
Hi all,

why is the following is invalid code?

Sub foo()

Dim MyRange As Range
Set MyRange = New Range

End Sub

The New statement works with a class defined in a Class Module, but it
looks like it doesn't work with classes in the Excel Object Model. Is
there any workaround for this? Thanks,

Best Regards

Sergio Rossi


All times are GMT +1. The time now is 01:26 AM.

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