ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Range("C9:V9").Select ==> changing the 9 to a variable (https://www.excelbanter.com/excel-worksheet-functions/27240-range-%22c9-v9%22-select-%3D%3D%3E-changing-9-variable.html)

B. F.

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


Don Guillett

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

"B. F." wrote in message
oups.com...
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




KL

Try:

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

Regards,
KL

"B. F." wrote in message
oups.com...
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




duane


range(cells(currow,3),cells((currow,22)).select


--
duane


------------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...o&userid=11624
View this thread: http://www.excelforum.com/showthread...hreadid=372974


Ron Coderre

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


JE McGimpsey

A couple of ways:

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

or

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




In article .com,
"B. F." 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


B. F.

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


B. F.

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


Don Guillett

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


--
Don Guillett
SalesAid Software

"B. F." wrote in message
oups.com...
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




All times are GMT +1. The time now is 04:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com