Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
formatting cell number based on previous cell number | Excel Discussion (Misc queries) | |||
number formatting based on cell value | Excel Programming | |||
Creating a certain number of entries based on a number in a cell | Excel Worksheet Functions | |||
returning a text cell based on a number cell | Excel Worksheet Functions | |||
sequential number based another cell | Excel Programming |