Link to home
Start Free TrialLog in
Avatar of Nickman87
Nickman87

asked on

Excel range from active sheet

I'm writing an Excel 2007 macro and I want to select a certain range from my active worksheet.

I tried using this:
    currRange = ActiveSheet.Range("List1")

But I get the error number 1004 on this line.
I just can't figure it out...
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Set currRange = ActiveSheet.Range("List1")
Nickman87,

With object variables, you must use the Set statement.

Regards,

Patrick
Avatar of Nickman87
Nickman87

ASKER

I tried this now :
    Dim currRange As Object
    Set currRange = ActiveSheet.Range("List1")

Still with no succes. I keep on getting the same error on the same spot.
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The error I get is this (in dutch):
        Door de toepassing of het object gedefinieerde fout
Wich is something like this in English:
        Error defined by the application or the object

So, what this actually means is that the object (I guess) is throwing me an Error (for some reason...)

I am sure the name "List1" exist, but could it be a problem that it is defined in two sheets?

Kind regards,
Nick
I found the problem...
Apparently the Range was not defined... I just tried on another computer and here the range does not exist...

Thanks for you help!