ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining Row in Which Labeled Cell Resides (https://www.excelbanter.com/excel-programming/361224-determining-row-labeled-cell-resides.html)

Chaplain Doug

Determining Row in Which Labeled Cell Resides
 
Excel 2003. I have a cell labeled "SEH." I want to be able to determine in
which row of the spreadsheet this Cell resides and to use that number
programmatically. This row is not in a fixed position (as my code inserts a
variable number of rows above this row). How may I get this labeled cell's
row number? Thanks and God bless for the help.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org

Ardus Petus

Determining Row in Which Labeled Cell Resides
 
Sub SEHrow()
Dim rFound As Range
Set rFound = ActiveSheet.UsedRange.Find("SEH", , , xlWhole)
If rFound Is Nothing Then
MsgBox "Not Found"
Else
MsgBox "Found at Row #" & rFound.Row & _
" Column #" & rFound.Column
End If
End Sub

HTH
--
AP

"Chaplain Doug" a écrit dans le
message de news: ...
Excel 2003. I have a cell labeled "SEH." I want to be able to determine
in
which row of the spreadsheet this Cell resides and to use that number
programmatically. This row is not in a fixed position (as my code inserts
a
variable number of rows above this row). How may I get this labeled
cell's
row number? Thanks and God bless for the help.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org



Chaplain Doug

Determining Row in Which Labeled Cell Resides
 
Dear Ardus:

What if I used:

Range("SEH").Select
I = Range.Row

I have tried this but Range.Row gives an error.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


"Ardus Petus" wrote:

Sub SEHrow()
Dim rFound As Range
Set rFound = ActiveSheet.UsedRange.Find("SEH", , , xlWhole)
If rFound Is Nothing Then
MsgBox "Not Found"
Else
MsgBox "Found at Row #" & rFound.Row & _
" Column #" & rFound.Column
End If
End Sub

HTH
--
AP

"Chaplain Doug" a écrit dans le
message de news: ...
Excel 2003. I have a cell labeled "SEH." I want to be able to determine
in
which row of the spreadsheet this Cell resides and to use that number
programmatically. This row is not in a fixed position (as my code inserts
a
variable number of rows above this row). How may I get this labeled
cell's
row number? Thanks and God bless for the help.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org




Chaplain Doug

Determining Row in Which Labeled Cell Resides
 
Better yet, this works

SEStart = ThisWorkbook.ActiveSheet.Range("SEH").Row

Thanks

--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


"Ardus Petus" wrote:

Sub SEHrow()
Dim rFound As Range
Set rFound = ActiveSheet.UsedRange.Find("SEH", , , xlWhole)
If rFound Is Nothing Then
MsgBox "Not Found"
Else
MsgBox "Found at Row #" & rFound.Row & _
" Column #" & rFound.Column
End If
End Sub

HTH
--
AP

"Chaplain Doug" a écrit dans le
message de news: ...
Excel 2003. I have a cell labeled "SEH." I want to be able to determine
in
which row of the spreadsheet this Cell resides and to use that number
programmatically. This row is not in a fixed position (as my code inserts
a
variable number of rows above this row). How may I get this labeled
cell's
row number? Thanks and God bless for the help.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org





All times are GMT +1. The time now is 11:21 AM.

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