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

Hi

I have a sheet of data in Excel, and I want to be able to search 2 or 3 of
the columns for occurances of a word, that will be specified via a textbox
or similar.

I then need to take any rows where the word is found, and show these on a
seperate sheet within the workbook (ie, search results).

Any help with this would be most appreciated.

Thanks in advance,

Darren


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Searching a spreadsheet

Watch for linewrap. Assumes that you have a sheet named "Search
Results" to deposit the data. The following sub looks for "Hello" in
the given range and copies the results to "Search Results" worksheet.

Sub FindMe()

Dim intS As Integer
Dim rngC As Range
Dim strToFind As String, FirstAddress As String
Dim wSht As Worksheet

Application.ScreenUpdating = False

intS = 1
Set wSht = Worksheets("Search Results")
strToFind = "Hello"

With ActiveSheet.Range("A1:C2000")
Set rngC = .Find(what:=strToFind, LookAt:=xlPart)
If Not rngC Is Nothing Then
FirstAddress = rngC.Address
Do
rngC.EntireRow.Copy wSht.Cells(intS, 1)
intS = intS + 1
Set rngC = .FindNext(rngC)
Loop While Not rngC Is Nothing And rngC.Address <
FirstAddress
End If
End With

End Sub

-------------------------------------------------------------------------------------------------------------

Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------
End SubOn Tue, 23 Sep 2003 20:11:55 +0100, "Darren"
wrote:

Hi

I have a sheet of data in Excel, and I want to be able to search 2 or 3 of
the columns for occurances of a word, that will be specified via a textbox
or similar.

I then need to take any rows where the word is found, and show these on a
seperate sheet within the workbook (ie, search results).

Any help with this would be most appreciated.

Thanks in advance,

Darren


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

Great, Thanks for help Paul.

Darren


wrote in message
...
Watch for linewrap. Assumes that you have a sheet named "Search
Results" to deposit the data. The following sub looks for "Hello" in
the given range and copies the results to "Search Results" worksheet.

Sub FindMe()

Dim intS As Integer
Dim rngC As Range
Dim strToFind As String, FirstAddress As String
Dim wSht As Worksheet

Application.ScreenUpdating = False

intS = 1
Set wSht = Worksheets("Search Results")
strToFind = "Hello"

With ActiveSheet.Range("A1:C2000")
Set rngC = .Find(what:=strToFind, LookAt:=xlPart)
If Not rngC Is Nothing Then
FirstAddress = rngC.Address
Do
rngC.EntireRow.Copy wSht.Cells(intS, 1)
intS = intS + 1
Set rngC = .FindNext(rngC)
Loop While Not rngC Is Nothing And rngC.Address <
FirstAddress
End If
End With

End Sub

--------------------------------------------------------------------------

-----------------------------------

Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
--------------------------------------------------------------------------

------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------

------------------------------------
End SubOn Tue, 23 Sep 2003 20:11:55 +0100, "Darren"
wrote:

Hi

I have a sheet of data in Excel, and I want to be able to search 2 or 3

of
the columns for occurances of a word, that will be specified via a

textbox
or similar.

I then need to take any rows where the word is found, and show these on a
seperate sheet within the workbook (ie, search results).

Any help with this would be most appreciated.

Thanks in advance,

Darren




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
Searching in Excel spreadsheet Tohvie Excel Discussion (Misc queries) 2 March 18th 10 10:39 PM
Searching and counting text in a spreadsheet jafarz Excel Discussion (Misc queries) 3 January 28th 09 09:13 PM
Formula for searching spreadsheet Lozza65 Excel Worksheet Functions 7 November 28th 07 11:35 PM
Searching a spreadsheet Ryan Excel Discussion (Misc queries) 4 July 24th 06 11:57 PM
extracting data from a spreadsheet by searching on columns Tom New Users to Excel 3 October 24th 05 10:36 PM


All times are GMT +1. The time now is 12:56 PM.

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"