It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

"Out of Range" on a basic function

Moderator: dafunkymunky

"Out of Range" on a basic function

Postby casucecle on Tue Aug 26, 2008 9:17 am

Hi,
I made a function to search through a sheet and give me the row that corresponds to "cherch", but an error appears "Run time error 9" Subscript out of range.
Here is the code

Public Function cherche(fichier, cherch, n, p, feuille) As Integer
While (Workbooks(fichier).Sheets(feuille).Cells(n, p).Value <> cherch) * (n < 1000)
n = n + 1
Wend
cherche = n
End Function

I tried to take the (n < 1000) part off but it does not change anything
Thx for the help
casucecle
 
Posts: 0
Joined: Tue Aug 26, 2008 9:10 am

Who is online

Users browsing this forum: No registered users and 5 guests