+ Reply to Thread
Results 1 to 4 of 4

How do you use the Worksheet property of the Range object?

  1. #1
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    How do you use the Worksheet property of the Range object?

    According to the Microsoft website, the Range object has a property called Worksheet.


    1. How do you use this?
    2. How is this possible when a range is a "subset" of a Worksheet?

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How do you use the Worksheet property of the Range object?

    Excel_vba,

    See here for details and examples:
    http://msdn.microsoft.com/en-us/libr.../ff837845.aspx
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: How do you use the Worksheet property of the Range object?

    Thank you Tiger. You can obtain the worksheet name by doing something like:

    Msgbox Worksheets(1).Name


    1. So I not sure why there would be a need to have a Range object before Worksheets(1).Name?
    2. I also this anyway with a Range:

    MsgBox Range("A1:A10").Worksheet.Name

    The Message returned was the name of sheet 1, which was "Andre." However, when I selected sheet 2 (which I named Larry), I still got "Andre" as the name returned even though sheet 2 (Larry) was the active sheet. Why does the code in the line above always return the name of sheet 1?

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: How do you use the Worksheet property of the Range object?

    Hi,

    The Message returned was the name of sheet 1, which was "Andre." However, when I selected sheet 2 (which I named Larry), I still got "Andre" as the name returned even though sheet 2 (Larry) was the active sheet. Why does the code in the line above always return the name of sheet 1?
    Are you sure? Because when I selected sheet2, it returned the name of sheet2.

    Code I used :

    Please Login or Register  to view this content.
    With that being said, I don't see a good reason to use this property...
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

+ 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. Using a range object as a property in a class
    By Lazhal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2010, 08:07 PM
  2. Difference between Range Property and Object?
    By antonymiller in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2009, 03:20 PM
  3. Range object/property problem.
    By mjsheen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2009, 03:21 AM
  4. [SOLVED] Range object lacks Value property
    By Raymond Langsford in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2006, 04:30 PM
  5. [SOLVED] How to use Cells property to Range object?
    By deko in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-08-2005, 04:06 PM

Tags for this Thread

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