LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,344
Default WorksheetFunction.Vlookup

Hi,

The standard approach when searching is to use code such as the sample shown
below:

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

Of course you would adjust this to meet your needs.

--
Thanks,
Shane Devenshire


"leerem" wrote:

Hi all,
I have a problem, that Iam racking my head over with no light at
the end of the tunnel, I've overlooked something which I obviously can't see.
I have the lines of code as listed below.
I need to check if the store number being added to the list already exists
before continuing. if the store number does exist the code works fine. The
problem i have is if the store number is not in the current list I get the
error message as listed below. What am I missing? Do I need to adjust the
code somehow?

Please help!

If Application.WorksheetFunction.Vlookup(StoreNo, Sheets("Store No's"). _
Range("B2:B2000"), 1, False) = StoreNo Then

MsgBox "This Store Number already exists," & vbNewLine _
& "Please try an alternative Number", vbOKOnly + vbQuestion, _
"Store Number already exists"
Unload Me
UserForm10.Show

Else More code

End If

I get the Error Message "unable to get the Vlookup property of the
WorksheetFunction Class"

Regards

Lee

 
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
"Unable to get the VLookup property of the WorksheetFunction class Ayo Excel Discussion (Misc queries) 4 August 6th 08 10:00 PM
WorksheetFunction help Ayo Excel Discussion (Misc queries) 2 July 20th 08 10:48 PM
Can't use WorksheetFunction Yossi Excel Discussion (Misc queries) 5 January 25th 06 10:07 PM
Worksheetfunction.vlookup and #value error BL Excel Worksheet Functions 2 June 17th 05 09:48 PM
WorksheetFunction with VBA Ghislain Marcotte Excel Discussion (Misc queries) 2 February 13th 05 07:08 AM


All times are GMT +1. The time now is 04:36 PM.

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

About Us

"It's about Microsoft Excel"