+ Reply to Thread
Results 1 to 2 of 2

Referring to set variable range.cells

  1. #1
    Registered User
    Join Date
    02-15-2013
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    13

    Referring to set variable range.cells

    Hi All,

    I am having difficulty understanding why the following code won't work. I get a "Compile error: Method or data member not found" on .InputRng.

    Here is the code:

    Please Login or Register  to view this content.
    For some reason that I can't understand the following code does work (where I do not set a variable to the range object):

    Please Login or Register  to view this content.
    The sub also runs with the following code:

    Please Login or Register  to view this content.
    I just can't figure out why the syntax for the fist sub gives the error.
    I am still learning the ins and outs of VBA so please assist. Many thanks.

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Referring to set variable range.cells

    The problem is because using this
    Please Login or Register  to view this content.
    Sets InputRng to the active sheet.

    If your active sheet is not Worksheets("Input"),
    Please Login or Register  to view this content.
    will give you the error.
    多么想要告诉你 我好喜欢你

+ 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. [SOLVED] Referring to a Variable Range of Columns for the SetSourceData Method
    By DobbsHead in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-29-2012, 03:56 PM
  2. referring to a range name (for Cells or Intersect, etc.)
    By evanzo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-06-2009, 02:06 PM
  3. referring to a range by variable
    By SuitedAces in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 12-27-2006, 07:17 AM
  4. [SOLVED] A Name range referring to different cells in different worksheets
    By Frederick Chow in forum Excel General
    Replies: 8
    Last Post: 03-05-2006, 11:50 AM
  5. Referring to cells in a filtered range
    By Stefi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-27-2005, 06:05 AM

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