+ Reply to Thread
Results 1 to 9 of 9

Range("C9:V9").Select ==> changing the 9 to a variable

  1. #1
    B. F.
    Guest

    Range("C9:V9").Select ==> changing the 9 to a variable

    I am defining the current selector row thru this statements:

    Dim Currow As Integer
    Currow = ActiveCell.Row

    Now I need to change:

    Range("C9:V9").Select

    to a variable range definition where the 9 is substituted by the value
    of the current row (Currow)
    I tried several ways of doing it by always got a "wrong syntax" error
    when executing.

    Coud you please help me ?
    TIA, Jorge


  2. #2
    Valued Forum Contributor
    Join Date
    07-11-2004
    Posts
    851
    range(cells(currow,3),cells((currow,22)).select
    not a professional, just trying to assist.....

  3. #3
    Don Guillett
    Guest

    Re: Range("C9:V9").Select ==> changing the 9 to a variable

    mr=activecell.row
    range(cells(mr,"c"),cells(mr,"v")).select

    but almost always not necessary to select. So what are you doing with your
    selection?

    range(cells(mr,"c"),cells(mr,"v")).copy ???

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "B. F." <[email protected]> wrote in message
    news:[email protected]...
    > I am defining the current selector row thru this statements:
    >
    > Dim Currow As Integer
    > Currow = ActiveCell.Row
    >
    > Now I need to change:
    >
    > Range("C9:V9").Select
    >
    > to a variable range definition where the 9 is substituted by the value
    > of the current row (Currow)
    > I tried several ways of doing it by always got a "wrong syntax" error
    > when executing.
    >
    > Coud you please help me ?
    > TIA, Jorge
    >




  4. #4
    KL
    Guest

    Re: Range("C9:V9").Select ==> changing the 9 to a variable

    Try:

    Range("C" & Currow & ":V" & Currow).Select

    Regards,
    KL

    "B. F." <[email protected]> wrote in message
    news:[email protected]...
    >I am defining the current selector row thru this statements:
    >
    > Dim Currow As Integer
    > Currow = ActiveCell.Row
    >
    > Now I need to change:
    >
    > Range("C9:V9").Select
    >
    > to a variable range definition where the 9 is substituted by the value
    > of the current row (Currow)
    > I tried several ways of doing it by always got a "wrong syntax" error
    > when executing.
    >
    > Coud you please help me ?
    > TIA, Jorge
    >




  5. #5
    JE McGimpsey
    Guest

    Re: Range("C9:V9").Select ==> changing the 9 to a variable

    A couple of ways:

    Cells(Currrow, 3).Resize(1, 20).Select

    or

    Range("C" & Currow & ":V" & Currow).Select




    In article <[email protected]>,
    "B. F." <[email protected]> wrote:

    > I am defining the current selector row thru this statements:
    >
    > Dim Currow As Integer
    > Currow = ActiveCell.Row
    >
    > Now I need to change:
    >
    > Range("C9:V9").Select
    >
    > to a variable range definition where the 9 is substituted by the value
    > of the current row (Currow)
    > I tried several ways of doing it by always got a "wrong syntax" error
    > when executing.
    >
    > Coud you please help me ?
    > TIA, Jorge


  6. #6
    Ron Coderre
    Guest

    RE: Range("C9:V9").Select ==> changing the 9 to a variable

    Two things:
    1)Not sure how you're doing it now, but this should work:

    Range("C" & CurrRow & ":V" & CurrRow).Select

    2)Excel has 65,536 rows, but Integer variables max out at 32,767. You might
    want to define currrow as Long (which goes somewhere past 2 million.

    --
    Regards,
    Ron


  7. #7
    B. F.
    Guest

    Re: Range("C9:V9").Select ==> changing the 9 to a variable

    Thanks a lot for the precise and VERY fast replies.
    My problem is solved in record time.
    Replying to Don=B4s question: the next steps are copy & paste.
    Best Regards, Jorge


  8. #8
    B. F.
    Guest

    Re: Range("C9:V9").Select ==> changing the 9 to a variable

    Thanks a lot for the precise and VERY fast replies.
    My problem is solved in record time.
    Replying to Don=B4s question: the next steps are copy & paste.
    Best Regards, Jorge


  9. #9
    Don Guillett
    Guest

    Re: Range("C9:V9").Select ==> changing the 9 to a variable

    range(cells(mr,"c"),cells(mr,"v")).copy range("a2")


    --
    Don Guillett
    SalesAid Software
    [email protected]
    "B. F." <[email protected]> wrote in message
    news:[email protected]...
    Thanks a lot for the precise and VERY fast replies.
    My problem is solved in record time.
    Replying to Donīs question: the next steps are copy & paste.
    Best Regards, Jorge



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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