ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get the number of a row (https://www.excelbanter.com/excel-programming/291104-how-get-number-row.html)

Candy[_2_]

How to get the number of a row
 
I am trying to draw a border line. But before dwaring a
line, I need to get the row number first. Below is the
sample code. How can I get the row number of c?

For Each c In Range("range_name")
'get the row number of c
'draw a border line
next c

Thanks.

Chip Pearson

How to get the number of a row
 
Candy,

The Row property of the range will return row number of that
cell. E.g,

Dim R As Long
For Each c In Range("range_name")
R = c.Row
'draw a border line
next c


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Candy" wrote in message
...
I am trying to draw a border line. But before dwaring a
line, I need to get the row number first. Below is the
sample code. How can I get the row number of c?

For Each c In Range("range_name")
'get the row number of c
'draw a border line
next c

Thanks.




Bob Phillips[_6_]

How to get the number of a row
 
Hi Candy,

For Each c In Range("range_name")
iRow = c.Row
next c


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Candy" wrote in message
...
I am trying to draw a border line. But before dwaring a
line, I need to get the row number first. Below is the
sample code. How can I get the row number of c?

For Each c In Range("range_name")
'get the row number of c
'draw a border line
next c

Thanks.




Rob van Gelder[_4_]

How to get the number of a row
 
Here's an example, with border drawing.

I'm guessing, but if you're going to draw row borders then you might just
want to do:
For Each c in Range("range_name").EntireRow

Sub test()
Dim c As Range, lngRow As Long

For Each c In Range("range_name")
lngRow = c.Row
Rows(lngRow).Borders(xlEdgeBottom).Weight = xlMedium
Next c
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Candy" wrote in message
...
I am trying to draw a border line. But before dwaring a
line, I need to get the row number first. Below is the
sample code. How can I get the row number of c?

For Each c In Range("range_name")
'get the row number of c
'draw a border line
next c

Thanks.





All times are GMT +1. The time now is 10:36 AM.

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