LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default using search function in VBA

Hi,
I'm very new to VBA. sorry for asking dumb question. I'm trying to do the
below and it is not working.

x = 500


Do While Cells(x, 2).Value < ""

y = 100

Do While Cells(y, 5).Value < ""

if worksheetfunction.search(cells(x, 2), cells(y, 5)) 0 then
' do something
end if
y = y + 1
loop
x = x + 1
loop

Here I want to search the text string of each cell from one range into
another range. How do I do this. The above code compiles fine. But I'm
getting a runtime error on the line "if worksheetfunction.search(cells(x, 2),
cells(y, 5)) 0 then". Looks like the search function can not take variable
such as x and y.
Thanks for any help!
 
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
SEARCH Function nc Excel Discussion (Misc queries) 2 August 5th 09 06:03 PM
SEARCH function lk[_4_] Excel Programming 2 May 7th 09 05:03 PM
Search Function TerryR Excel Discussion (Misc queries) 3 February 17th 09 09:32 AM
search function crodriguez1976 New Users to Excel 3 August 17th 06 01:39 PM
search function sixfivebeastman[_4_] Excel Programming 0 August 4th 04 03:57 PM


All times are GMT +1. The time now is 08:04 AM.

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"