+ Reply to Thread
Results 1 to 5 of 5

Which is unsupported?

  1. #1
    davegb
    Guest

    Which is unsupported?

    Simple code:
    Sub CRSPPPMod()
    Dim Wksht As Worksheet
    Call Clean
    Set Wksht = ActiveSheet
    Wksht("Sheet1").Range("A8:AE1000").Select<----ERROR
    Selection.UnMerge

    End Sub

    Getting an "object does not support this property or method" error at
    marked line. I checked the Object Browser. I think it says that a
    worksheet can have a range, and a range can be selected. So how am I
    misinterpreting the OB?
    Thanks in advance.


  2. #2
    Chip Pearson
    Guest

    Re: Which is unsupported?

    You cannot select a range on a sheet that is not the active
    sheet. You must select the worksheet first, then select the
    range. E.g.,

    Worksheets("Sheet1").Select
    Range("A8:AE1000").Select


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com




    "davegb" <[email protected]> wrote in message
    news:[email protected]...
    > Simple code:
    > Sub CRSPPPMod()
    > Dim Wksht As Worksheet
    > Call Clean
    > Set Wksht = ActiveSheet
    > Wksht("Sheet1").Range("A8:AE1000").Select<----ERROR
    > Selection.UnMerge
    >
    > End Sub
    >
    > Getting an "object does not support this property or method"
    > error at
    > marked line. I checked the Object Browser. I think it says that
    > a
    > worksheet can have a range, and a range can be selected. So how
    > am I
    > misinterpreting the OB?
    > Thanks in advance.
    >




  3. #3
    Rowan Drummond
    Guest

    Re: Which is unsupported?

    You have declared the object variable Wksht and then set it to the
    activesheet so you don't need the sheet name anymore:

    Set Wksht = ActiveSheet
    Wksht.Range("A8:AE1000").Select
    Selection.UnMerge

    Regards
    Rowan

    davegb wrote:
    > Simple code:
    > Sub CRSPPPMod()
    > Dim Wksht As Worksheet
    > Call Clean
    > Set Wksht = ActiveSheet
    > Wksht("Sheet1").Range("A8:AE1000").Select<----ERROR
    > Selection.UnMerge
    >
    > End Sub
    >
    > Getting an "object does not support this property or method" error at
    > marked line. I checked the Object Browser. I think it says that a
    > worksheet can have a range, and a range can be selected. So how am I
    > misinterpreting the OB?
    > Thanks in advance.
    >


  4. #4
    davegb
    Guest

    Re: Which is unsupported?

    Thanks to you both!


  5. #5
    Rowan Drummond
    Guest

    Re: Which is unsupported?

    You're welcome.

    davegb wrote:
    > Thanks to you both!
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1