+ Reply to Thread
Results 1 to 4 of 4

Range representing a single row of a named range

  1. #1
    Registered User
    Join Date
    10-29-2007
    Posts
    5

    Question Range representing a single row of a named range

    Hi guys,

    I have a named range called "DATA" in a worksheet (its about 100rows x 20cols) and I'm trying to write some code to return a range that represents a single row of range("DATA") based upon the active cell. However I don't want EntireRow.

    To do this I'm using Worksheet_SelectionChange(ByVal Target As Range) event and I've used the Intersect function to test that Target is in Range("DATA").

    Then for example:

    Imagine Range("DATA") is C10:V110. When I select K43 ie Target is K43, I want the range C43:V43 to be returned to a variable in VBA.

    How can I do this?

    Thanks in advance

    Jonny

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Range representing a single row of a named range

    Something like

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Range representing a single row of a named range

    Maybe something like this:

    Please Login or Register  to view this content.

    That code selects the intersection of the DATA range and
    the row of the top-left cell of the new selection.
    (in case the user selected a range of cells)

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    10-29-2007
    Posts
    5

    Re: Range representing a single row of a named range

    Thanks guys,

    You've solved my problem. Here's what I was trying to do...underline active row of range DATA with a medium weight border.

    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)

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