Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Finding Rows

  Asked By: Mada    Date: Sep 19    Category: MS Office    Views: 512
  

I am trying to search through a sheet, find a value (date) then return
the row nuber of that date. I found this code on the web, but I get an
error. I am using Excel 2000.

Function FindRowNumber(strText) As Integer
FindRowNumber = ActiveSheet.Range("A1:A3000").Find
(strText).Cells.Row
End Function

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Chaths Massri     Answered On: Sep 19

Try this instead:

Function FindRowNumber(strText) As Integer
Dim TryFind As Range
With ActiveSheet.Range("A1:A3000")
Set TryFind = .Find(strText)
If Not TryFind Is Nothing Then
MsgBox TryFind.Row
Else
MsgBox "Not found!"
End If
End With
End Function

 
Answer #2    Answered By: Tarron Thompson     Answered On: Sep 19

The code  that you provide below works fine as is. Just make sure you
have pasted it within a Module.

 
Didn't find what you were looking for? Find more on Finding Rows Or get search suggestion and latest updates.




Tagged: