Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How can I get the row number Based on cell value

I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value of
"Fish" and "Fish" is in B1207. I would just like the Function to give back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default How can I get the row number Based on cell value

Hi Kevin,

Try This...

Please note that the function takes the column Number...

Function FindRow(Column1 As Integer, TextToFind As String)
Dim i as integer
Dim cell As Object
For i = 1 To 65536
RowOfText = 0
If Cells(i, Column1).Value < "" Then
If Cells(i, Column1).Value = TextToFind Then
RowOfText = i
GoTo 8
End If
End If
Next i

8: If RowOfText = 0 Then
FindRow = 0
Else
FindRow = RowOfText
End If

End Function

Regards
Ankur / Kanchan
www.xlmacros.com

Kc-Mass wrote:

I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value of
"Fish" and "Fish" is in B1207. I would just like the Function to give back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default How can I get the row number Based on cell value

Hi Kevin,

Try This...

Please note that the function takes the column Number...

Function FindRow(Column1 As Integer, TextToFind As String)
Dim i as integer
Dim cell As Object
For i = 1 To 65536
RowOfText = 0
If Cells(i, Column1).Value < "" Then
If Cells(i, Column1).Value = TextToFind Then
RowOfText = i
GoTo 8
End If
End If
Next i

8: If RowOfText = 0 Then
FindRow = 0
Else
FindRow = RowOfText
End If

End Function

Regards
Ankur / Kanchan
www.xlmacros.com

Kc-Mass wrote:

I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value of
"Fish" and "Fish" is in B1207. I would just like the Function to give back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default How can I get the row number Based on cell value

Hi Kevin,

Try This...

Please note that the function takes the column Number...

Function FindRow(Column1 As Integer, TextToFind As String)
Dim i as integer
Dim cell As Object
For i = 1 To 65536
RowOfText = 0
If Cells(i, Column1).Value < "" Then
If Cells(i, Column1).Value = TextToFind Then
RowOfText = i
GoTo 8
End If
End If
Next i

8: If RowOfText = 0 Then
FindRow = 0
Else
FindRow = RowOfText
End If

End Function

Regards
Ankur / Kanchan
www.xlmacros.com

Kc-Mass wrote:

I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value of
"Fish" and "Fish" is in B1207. I would just like the Function to give back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default How can I get the row number Based on cell value

Hi Kevin,

Try This...

Please note that the function takes the column Number...

Function FindRow(Column1 As Integer, TextToFind As String)
Dim i as integer
Dim cell As Object
For i = 1 To 65536
RowOfText = 0
If Cells(i, Column1).Value < "" Then
If Cells(i, Column1).Value = TextToFind Then
RowOfText = i
GoTo 8
End If
End If
Next i

8: If RowOfText = 0 Then
FindRow = 0
Else
FindRow = RowOfText
End If

End Function

Regards
Ankur / Kanchan
www.xlmacros.com

Kc-Mass wrote:

I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value of
"Fish" and "Fish" is in B1207. I would just like the Function to give back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default How can I get the row number Based on cell value

Hi Kevin,

Try This...

Please note that the function takes the column Number...

Function FindRow(Column1 As Integer, TextToFind As String)
Dim i as integer
Dim cell As Object
For i = 1 To 65536
RowOfText = 0
If Cells(i, Column1).Value < "" Then
If Cells(i, Column1).Value = TextToFind Then
RowOfText = i
GoTo 8
End If
End If
Next i

8: If RowOfText = 0 Then
FindRow = 0
Else
FindRow = RowOfText
End If

End Function

Regards
Ankur / Kanchan
www.xlmacros.com

Kc-Mass wrote:

I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value of
"Fish" and "Fish" is in B1207. I would just like the Function to give back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default How can I get the row number Based on cell value

Hi Kevin,

Try This...

Please note that the function takes the column Number...

Function FindRow(Column1 As Integer, TextToFind As String)
Dim i as integer
Dim cell As Object
For i = 1 To 65536
RowOfText = 0
If Cells(i, Column1).Value < "" Then
If Cells(i, Column1).Value = TextToFind Then
RowOfText = i
GoTo 8
End If
End If
Next i

8: If RowOfText = 0 Then
FindRow = 0
Else
FindRow = RowOfText
End If

End Function

Regards
Ankur / Kanchan
www.xlmacros.com

Kc-Mass wrote:

I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value of
"Fish" and "Fish" is in B1207. I would just like the Function to give back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default How can I get the row number Based on cell value

Hi Kevin,

Try This...

Please note that the function takes the column Number...

Function FindRow(Column1 As Integer, TextToFind As String)
Dim i as integer
Dim cell As Object
For i = 1 To 65536
RowOfText = 0
If Cells(i, Column1).Value < "" Then
If Cells(i, Column1).Value = TextToFind Then
RowOfText = i
GoTo 8
End If
End If
Next i

8: If RowOfText = 0 Then
FindRow = 0
Else
FindRow = RowOfText
End If

End Function

Regards
Ankur / Kanchan
www.xlmacros.com

Kc-Mass wrote:

I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value of
"Fish" and "Fish" is in B1207. I would just like the Function to give back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default How can I get the row number Based on cell value

Hi Kevin,

Try This...

Please note that the function takes the column Number...

Function FindRow(Column1 As Integer, TextToFind As String)
Dim i as integer
Dim cell As Object
For i = 1 To 65536
RowOfText = 0
If Cells(i, Column1).Value < "" Then
If Cells(i, Column1).Value = TextToFind Then
RowOfText = i
GoTo 8
End If
End If
Next i

8: If RowOfText = 0 Then
FindRow = 0
Else
FindRow = RowOfText
End If

End Function

Regards
Ankur / Kanchan
www.xlmacros.com

Kc-Mass wrote:

I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value of
"Fish" and "Fish" is in B1207. I would just like the Function to give back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How can I get the row number Based on cell value

Thanks for all the help!

I have it now.

You folks are great!

Kevin C
"Kc-Mass" <connearney_AT_comcast_PERIOD_net wrote in message
. ..
I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value
of
"Fish" and "Fish" is in B1207. I would just like the Function to give
back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C






  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 256
Default How can I get the row number Based on cell value

Use Excel.Worksheet's UsedRange.Rows.Count to iterate through all the
rows.

Also, check for empty cells like so:

If Len(.Cells(iRow, iCol).Value) Then
' check to see whether the value is what you're looking for
End If

"""Kc-Mass ΠΙΣΑΜ(Α):
"""
Thanks for all the help!

I have it now.

You folks are great!

Kevin C
"Kc-Mass" <connearney_AT_comcast_PERIOD_net wrote in message
. ..
I am good with access new with Excel

What I want to do, in VBA, is search Column B and get the row number
for the first occurence of a value. Let's say I am searching for a value
of
"Fish" and "Fish" is in B1207. I would just like the Function to give
back
the row number 1207.

Something Like:

Function FindRow ( Column, TextToFind)

Code
Code
Findrow = X
End Function

A. Is it possible.

B. Could you give me an idea of what I am looking for and where I
should look.

Thx

Kevin C



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
formatting cell number based on previous cell number Pasquini Excel Discussion (Misc queries) 3 June 20th 06 06:36 AM
number formatting based on cell value helen@bgs Excel Programming 5 September 25th 05 02:46 AM
Creating a certain number of entries based on a number in a cell PPV Excel Worksheet Functions 4 June 16th 05 10:25 PM
returning a text cell based on a number cell Josh7777777 Excel Worksheet Functions 2 November 2nd 04 07:42 PM
sequential number based another cell martinrrrr - ExcelForums.com Excel Programming 2 September 30th 04 06:40 PM


All times are GMT +1. The time now is 10:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"