ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Select a Row in VB Macro (https://www.excelbanter.com/excel-programming/303314-how-select-row-vbulletin-macro.html)

Alan Tang

How to Select a Row in VB Macro
 
Hello:

I have try to use the following statment for select a row
and work fine.

Rows("2:2").Select

After I have change the value as show below, it can't work!

Rows("RowX:RowX").Select

For the Value os RowX is 3 as integer.

Thanks!



papou[_9_]

How to Select a Row in VB Macro
 
Hi alan
Dim RowX&
RowX = 3
Rows(RowX).Select

HTH
Cordially
Pascal

"Alan Tang" a écrit dans le message de
...
Hello:

I have try to use the following statment for select a row
and work fine.

Rows("2:2").Select

After I have change the value as show below, it can't work!

Rows("RowX:RowX").Select

For the Value os RowX is 3 as integer.

Thanks!





Andy Pope

How to Select a Row in VB Macro
 
Alan,

Try removing the variable names from within the quotes,

Rows(RowX & ":" & RowX).select

Also you may want to make the variable a Long, in case the value stored
is greater than 32,767.

Cheers
Andy

Alan Tang wrote:

Hello:

I have try to use the following statment for select a row
and work fine.

Rows("2:2").Select

After I have change the value as show below, it can't work!

Rows("RowX:RowX").Select

For the Value os RowX is 3 as integer.

Thanks!



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


All times are GMT +1. The time now is 02:44 AM.

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