+ Reply to Thread
Results 1 to 5 of 5

Reference an Entire Row using Variable Names in Range Function

  1. #1
    Registered User
    Join Date
    10-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Reference an Entire Row using Variable Names in Range Function

    Hi - this is simple but I am new to VBA so the syntax really messes me up.

    I want to select an entire row but use a variable as I will be referencing this row later. I wasn't sure if I needed to use Long or Int and how to reference the variable. It seems like every time I try to reference variables in a range and use a colon I get an error.

    PS I know I shouldn't use select. Thanks in advance

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Reference an Entire Row using Variable Names in Range Function

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Reference an Entire Row using Variable Names in Range Function

    Use Long so it can handle the larger row numbers

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    10-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Reference an Entire Row using Variable Names in Range Function

    Very Helpful. Thank You.

    Now if I want to select A22 to D22 where LastCol is a long of 2 from a find method I try to write this:

    Please Login or Register  to view this content.
    Do I need to use Cells nested in my range?
    Please Login or Register  to view this content.
    I figured it out

    Please Login or Register  to view this content.
    Last edited by whittbullard; 10-28-2013 at 12:54 PM.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Reference an Entire Row using Variable Names in Range Function

    As you have row and column information as numbers use

    Please Login or Register  to view this content.

+ 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. Replies: 9
    Last Post: 10-02-2011, 08:37 PM
  2. [SOLVED] A function to get a variable row reference for range in XNPV funct
    By Tex1960 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 02:05 PM
  3. [SOLVED] A function to get a variable row reference for range in XNPV funct
    By Tex1960 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  4. A function to get a variable row reference for range in XNPV funct
    By Tex1960 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  5. A function to get a variable row reference for range in XNPV funct
    By Tex1960 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12: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