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: 27
Default Find value of active cell in other visible worksheets

Starting in the first worksheet (Sheet00.Name), I wish to search all visible
worksheets for a value (value of the active cell).
(The user of the spreadsheet will click a command button for this VBA to run)
[I have turned off the On Error instruction, while testing this out...]

Private Sub FindCellContent()

'On Error GoTo addError1

Dim CellLocation As Range
Dim CellContent As String
Dim Sh As Worksheet

' Capture cell information
Set CellLocation = ActiveCell
CellContent = ActiveCell

' Start at the first Worksheet
Sheets(Sheet31.Name).Select
Range("A1").Select

' Search for CellContent in all Visible Worksheets
For Each Sh In ThisWorkbook.Worksheets
' If Sh.Visible = xlSheetVisible Then
If Cells.Find(What:=CellContent, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate Then
Exit For
End If
' End If
Next


'addError1:

' Application.GoTo Reference:=CellLocation
' MsgBox "Cell content not found in other worksheets"
' Exit Sub

End Sub

Thank you... Clive
 
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
Find previous active cell Otto Moehrbach[_2_] Excel Programming 1 June 18th 08 08:46 PM
Find address of active cell Dave Excel Worksheet Functions 5 September 6th 06 06:43 PM
find range name for active cell Len Excel Programming 2 November 22nd 05 02:37 PM
find text in a cell and make cell 2 cells below that active shark102 Excel Programming 4 October 20th 05 02:41 PM
Find active cell Thomas[_13_] Excel Programming 5 February 18th 04 04:34 PM


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