Results 1 to 5 of 5

Thread: ** RESOLVED ** Excel Range - Getting start and end row

  1. #1

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    ** RESOLVED ** Excel Range - Getting start and end row

    If a range is highlighted in Excel, does anyone know how to get at the start row and the end row of the selection ?

    Its probably obvious, but I can't find it yet


    Thanks in advance ....
    Last edited by TheBionicOrange; Nov 19th, 2002 at 06:15 AM.

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    South Africa
    Posts
    113
    Range("F12:G17").Select is the select code. then just play with the actual parameters.

    so now if you dont know the start and end row, just read each cell one at a time until the contents of a cell are null, and keep incrementing a counter. that assumes that all the cells are filled consecutively and then it breaks at a null.
    You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!

  3. #3

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    The problem is I don't the range. I am using :

    VB Code:
    1. objExcel.Range(Selection, Selection.End(xlDown)).Select

    due to variable length data.

    Under certain conditions it will jump to row 65536. This is what I need to trap.

  4. #4
    Lively Member
    Join Date
    Aug 2000
    Location
    South Africa
    Posts
    113

    apologies

    I realise that I misread your question.
    You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!

  5. #5

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    OK found the syntax ..... easy when you know how

    VB Code:
    1. objexcel.selection.address

    This returns an address in R1C1 notation e.g. $A$4:$Y$65536


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width