Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178

    Unanswered: SETting a Range object

    I need to be able to set a Range object. In my VBA, I'm selecting Range("B2"). Now I need to set a new Range object, called Rng, to the range. Every time I try to set it, though, I get the value of the range, not a range object, even though Rng is DIMmed as a Range.

    If I change Rng to an Object, and try the statement Set Rng = CreateObject("Excel.Range"), I get the error "ActiveX component can't create object." If I use Set Rng = CreateObject("Excel.Application"), however, it does work.

    When I look in my Object Browser, I only find CreateObject in the VBA.Interaction class, nowhere else.

    How do I do this?

    Thanks,

    Sam
    Last edited by Sam Landy; 06-14-06 at 13:02.

  2. #2
    Join Date
    Mar 2006
    Posts
    163
    Sam

    Where are you doing this from?

    Can you post what code you have so far?

  3. #3
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Thanks for taking the time to reply. I was in crunch mode, so I changed Rng to a string and used it that way. The Range object was something I was experimenting with, and I guess I still haven't perfected it. Oh, well. There's always next time.

    Thanks again.

    Sam

  4. #4
    Join Date
    Mar 2006
    Posts
    163
    Sam

    Glad you got it to work.

    Perhaps if you posted the code we could point out where you are going wrong with the range object.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •