#1   Report Post  
Posted to microsoft.public.excel.misc
Mistysweep
 
Posts: n/a
Default Displaying data

Good morning everyone.

I have a number of worksheets all in the same workbook containing five or
six columns of data.

Is there a way of searching all of the worksheets for a value I enter
(perhaps on a seperate worksheet) so that the entire row(s) that contain that
value are returned?


Is this possible?




--
Many thanks

Mistysweep
  #2   Report Post  
Posted to microsoft.public.excel.misc
bgeier
 
Posts: n/a
Default Displaying data


Is this what you had in mind?
On "Sheet4" cell "a2" put what you want to look for.
The macro will loop through each sheet, highlighting the row the search
string was found on and put the row number and sheet name on Sheet 4
columns 2 and 3 respectively


Sub FindSomething()

Dim intSheetCounter As Integer
Dim strFoundrow As String
Dim intPlaceRow As Integer

intPlaceRow = 2
For intSheetCounter = 1 To Worksheets.Count
Worksheets(intSheetCounter).Select
cells(1,1).select
Cells.Find(ThisWorkbook.Worksheets("Sheet4").Cells (2, 1).Value,
ActiveCell, xlFormulas, xlWhole, xlByColumns, xlNext, False,
False).EntireRow.Select
strFoundrow =
Cells.Find(ThisWorkbook.Worksheets("Sheet4").Cells (2, 1).Value,
ActiveCell, xlFormulas, xlWhole, xlByColumns, xlNext, False,
False).Row
ThisWorkbook.Worksheets("Sheet4").Cells(intPlaceRo w, 3) =
Worksheets(intSheetCounter).Name
ThisWorkbook.Worksheets("Sheet4").Cells(intPlaceRo w, 2) =
strFoundrow
intPlaceRow = intPlaceRow + 1
Next
End Sub


--
bgeier
------------------------------------------------------------------------
bgeier's Profile: http://www.excelforum.com/member.php...o&userid=12822
View this thread: http://www.excelforum.com/showthread...hreadid=542057

  #3   Report Post  
Posted to microsoft.public.excel.misc
Mistysweep
 
Posts: n/a
Default Displaying data

Tried it and keep getting a compile error - syntax error at :-

Cells.Find(ThisWorkbook.Worksheets("Sheet4").Cells (2,1).Value.

Any ideas?

--
Many thanks

Mistysweep


"bgeier" wrote:


Is this what you had in mind?
On "Sheet4" cell "a2" put what you want to look for.
The macro will loop through each sheet, highlighting the row the search
string was found on and put the row number and sheet name on Sheet 4
columns 2 and 3 respectively


Sub FindSomething()

Dim intSheetCounter As Integer
Dim strFoundrow As String
Dim intPlaceRow As Integer

intPlaceRow = 2
For intSheetCounter = 1 To Worksheets.Count
Worksheets(intSheetCounter).Select
cells(1,1).select
Cells.Find(ThisWorkbook.Worksheets("Sheet4").Cells (2, 1).Value,
ActiveCell, xlFormulas, xlWhole, xlByColumns, xlNext, False,
False).EntireRow.Select
strFoundrow =
Cells.Find(ThisWorkbook.Worksheets("Sheet4").Cells (2, 1).Value,
ActiveCell, xlFormulas, xlWhole, xlByColumns, xlNext, False,
False).Row
ThisWorkbook.Worksheets("Sheet4").Cells(intPlaceRo w, 3) =
Worksheets(intSheetCounter).Name
ThisWorkbook.Worksheets("Sheet4").Cells(intPlaceRo w, 2) =
strFoundrow
intPlaceRow = intPlaceRow + 1
Next
End Sub


--
bgeier
------------------------------------------------------------------------
bgeier's Profile: http://www.excelforum.com/member.php...o&userid=12822
View this thread: http://www.excelforum.com/showthread...hreadid=542057


  #4   Report Post  
Posted to microsoft.public.excel.misc
bgeier
 
Posts: n/a
Default Displaying data


Cells.Find(ThisWorkbook.Worksheets("Sheet4").Cells (2, 1).Value,
ActiveCell, xlFormulas, xlWhole, xlByColumns, xlNext, False,
False).EntireRow.Select

Check you have commas after
Value
ActiveCell
xlFormulas
xlWhole
xlByColumns
xlNext
False

I tested it on my machine again and it worked


--
bgeier
------------------------------------------------------------------------
bgeier's Profile: http://www.excelforum.com/member.php...o&userid=12822
View this thread: http://www.excelforum.com/showthread...hreadid=542057

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
ranking query JaimeTimbrell Excel Discussion (Misc queries) 2 February 16th 06 08:09 AM
Displaying single and multiple data series.Single data series Donald Macleod Charts and Charting in Excel 2 January 30th 06 02:52 AM
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM
Line Graph Data Recognition Nat Charts and Charting in Excel 2 April 30th 05 02:07 PM
Displaying, manipulating and printing huge lists of data BCBS Excel Worksheet Functions 2 April 9th 05 12:43 AM


All times are GMT +1. The time now is 07:37 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"