+ Reply to Thread
Results 1 to 8 of 8

Problem with a Range Name

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Problem with a Range Name

    I have tried to use the following code to copy a given range and paste it into a new workbook which I will then file with a new name.
    Please Login or Register  to view this content.
    I get an error message "object does not support the named Property or method at line marked 10. In most cases when I have got this error it has been caused by a typo. On this occasion though Rangename is right and the range does exist in wbSource in wsSource. Where else could I have gone wrong?

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Problem with a Range Name

    How are you calling the subroutine

    This format only works as a subroutine and must be called by another Macro.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Problem with a Range Name

    mehmetcik,
    Thanks for your interest.
    The routine OutputText is called by the following routine fired by clicking a button on a userform.
    Please Login or Register  to view this content.
    The routine PasteDownN is simply a way of copying and pasting formulae.
    The reason I have two output routines, Output and OutputText, is that Output deals with those situations where I need to copy to several sheets in a new workbook.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Problem with a Range Name

    A workbook doesn't have a Range property - that applies to either a Worksheet or the Application object.
    Rory

  5. #5
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Problem with a Range Name

    Ive changed the offending line to:-
    Please Login or Register  to view this content.
    I still get the same error. If this code is OK I think I must have a typo that I've missed.
    John

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Problem with a Range Name

    Remove the wbsource. part from the start, so it's just:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Problem with a Range Name

    That's all it was. All is working as I wanted.
    Many thanks for your help.
    I am a bit puzzled though. When I am working with one workbook with many worksheets it is not necessary to use the worksheet name when referring to a named range, though it is necessary when referring to an ordinary range. This is why I used the workbook name and the rangename only and got the error. There is obviously something here that I don't understand properly.
    John

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Problem with a Range Name

    In a normal module, you can use Range on its own, and it's equivalent to Application.Range which will work with either a regular range address (returning a range on the active sheet) or a workbook-level named range defined in the active workbook. You can't use workbook.range with any type of range, though you could use the Workbook.Names collection - perhaps that's what you were thinking of?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problem when using Named Range instead of simple Range
    By unit285 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-15-2016, 02:58 PM
  2. [SOLVED] VLOOKUP and Fill Handle Problem: Selected Range vs. Named Range
    By Menenius in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 01-12-2016, 08:50 PM
  3. [SOLVED] Set range problem
    By Blokeman in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-03-2014, 12:45 AM
  4. [SOLVED] Range problem....
    By puuts in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2014, 04:44 PM
  5. Problem using loop for sending excel range in email body using Range to HTML code
    By drajanm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-24-2012, 03:17 AM
  6. Range problem
    By amitav in forum Excel General
    Replies: 1
    Last Post: 11-28-2012, 03:33 PM
  7. Replies: 15
    Last Post: 04-25-2012, 05:21 PM

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