ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select specic no. of rows down (https://www.excelbanter.com/excel-programming/339258-select-specic-no-rows-down.html)

leung

Select specic no. of rows down
 
Hi
is there quick vba code to select specific no. of entire row down?

sub select_row_down(byval intRow as long)

???selection.entirerow.select???
???????

end sub

thanks

Leung

R.VENKATARAMAN

Select specic no. of rows down
 
can we not use
range("a1").offset(5,0)
it will godown 5 rows.from A1
have I understood your question.

"Leung" wrote in message
...
Hi
is there quick vba code to select specific no. of entire row down?

sub select_row_down(byval intRow as long)

???selection.entirerow.select???
???????

end sub

thanks

Leung




Norman Jones

Select specic no. of rows down
 
Hi Leung,

Perhaps something like:

'=====================
Public Sub Tester1()
Dim Rng As Range
Const NumOfRows = 10 '<<====== CHANGE

Set Rng = ActiveCell.EntireRow.Resize(NumOfRows)

End Sub

'<<=====================

BTW, it is rarely necessary, or desirable, to make selections. In the above
example, manipulation can be effected on the Rng object variable without any
selection. E.g.:

Rng.Interior.ColorIndex = 36


---
Regards,
Norman



"Leung" wrote in message
...
Hi
is there quick vba code to select specific no. of entire row down?

sub select_row_down(byval intRow as long)

???selection.entirerow.select???
???????

end sub

thanks

Leung




Norman Jones

Select specic no. of rows down
 
Hi Leung,

Const NumOfRows = 10 '<<====== CHANGE


should read:

Const NumOfRows As Long = 10 '<<====== CHANGE

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Leung,

Perhaps something like:

'=====================
Public Sub Tester1()
Dim Rng As Range
Const NumOfRows = 10 '<<====== CHANGE

Set Rng = ActiveCell.EntireRow.Resize(NumOfRows)

End Sub

'<<=====================

BTW, it is rarely necessary, or desirable, to make selections. In the
above example, manipulation can be effected on the Rng object variable
without any selection. E.g.:

Rng.Interior.ColorIndex = 36


---
Regards,
Norman



"Leung" wrote in message
...
Hi
is there quick vba code to select specific no. of entire row down?

sub select_row_down(byval intRow as long)

???selection.entirerow.select???
???????

end sub

thanks

Leung







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

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