Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default Searching question

My sheet contains several rows of data and the number or
rows will grow each day. At the end of the year, I'm
guessing that this sheet will contain between 500 and 600
rows of data.

I created a search macro which basically steps though each
row one at a time (using a For-Next loop). I then do simple
string comparison to check if the row of data matches the
search criteria.

If anyone else here was given the task of creating a similar
searching system in Excel, what would you do?? I often
hear about using auto filters and VLOOKUP & MATCH
functions, so I often wonder if my search method is
too simple minded or not.

I'd appreciate any opinions. thank u


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default Searching question

Sub SearchSheet()
Dim Srch As String
Srch = InputBox("What are you searching for?")
If Srch = "" Then Exit Sub
On Error Resume Next
Set rg = Cells.Find(Srch, Lookat:=xlPart)
If Not rg Is Nothing Then
rg.Select
Else
MsgBox Srch & " not found."
End If
End Sub


"Robert Crandal" wrote in message
...
My sheet contains several rows of data and the number or
rows will grow each day. At the end of the year, I'm
guessing that this sheet will contain between 500 and 600
rows of data.

I created a search macro which basically steps though each
row one at a time (using a For-Next loop). I then do simple
string comparison to check if the row of data matches the
search criteria.

If anyone else here was given the task of creating a similar
searching system in Excel, what would you do?? I often
hear about using auto filters and VLOOKUP & MATCH
functions, so I often wonder if my search method is
too simple minded or not.

I'd appreciate any opinions. thank u


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default Searching question

Will this code only find the first instance and then stop?
I'm just curious, since I've never used that .Find()
function before.


"Bob Umlas" wrote in message
...
Sub SearchSheet()
Dim Srch As String
Srch = InputBox("What are you searching for?")
If Srch = "" Then Exit Sub
On Error Resume Next
Set rg = Cells.Find(Srch, Lookat:=xlPart)
If Not rg Is Nothing Then
rg.Select
Else
MsgBox Srch & " not found."
End If
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Searching question

This code selects the first match it finds and stops.

But if you look in VBA's help for FindNext, you'll see a way to loop through to
find more/all.

Robert Crandal wrote:

Will this code only find the first instance and then stop?
I'm just curious, since I've never used that .Find()
function before.

"Bob Umlas" wrote in message
...
Sub SearchSheet()
Dim Srch As String
Srch = InputBox("What are you searching for?")
If Srch = "" Then Exit Sub
On Error Resume Next
Set rg = Cells.Find(Srch, Lookat:=xlPart)
If Not rg Is Nothing Then
rg.Select
Else
MsgBox Srch & " not found."
End If
End Sub



--

Dave Peterson
Reply
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
Program Speed - Arrays Searching vs. Row Searching CWillis Excel Programming 8 June 4th 09 06:42 PM
Searching or Find question excelneophyte Excel Discussion (Misc queries) 5 July 18th 08 11:31 PM
Searching for... FC Excel Discussion (Misc queries) 2 October 13th 07 04:31 PM
Searching, matching then searching another list based on the match A.S. Excel Discussion (Misc queries) 1 December 13th 06 05:08 AM
Question??Searching form frankosun[_2_] Excel Programming 2 December 13th 05 07:12 AM


All times are GMT +1. The time now is 10:40 AM.

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"