Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i'm trying to search across multiple sheets based on data submitted via an
input box. So essentially, you click the button, a box appears, you type what your looking for and if it finds it, it'll select it otherwise a error message appeats. i found the below code, but it only works if the cell with the value in it is active (i.e. i've clicked on it). Code: Dim datatoFind Dim sheetCount As Integer Dim counter As Integer Dim currentSheet As Integer On Error Resume Next currentSheet = ActiveSheet.Index datatoFind = InputBox("Please enter the value to search for") If datatoFind = "" Then Exit Sub sheetCount = ActiveWorkbook.Sheets.Count If IsError(CDbl(datatoFind)) = False Then datatoFind = CDbl(datatoFind) For counter = 1 To sheetCount Sheets(counter).Activate Cells.Find(What:=datatoFind, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False).Activate If ActiveCell.Value = datatoFind Then Exit For Next counter If ActiveCell.Value < datatoFind Then MsgBox ("Value not found") Sheets(currentSheet).Activate End If thanks in advance :) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
search, copy and paste through multiple sheets | Excel Discussion (Misc queries) | |||
Search Multiple Sheets Then Add Txt1.Txt to Cell | Excel Programming | |||
Search in Multiple Sheets | Excel Discussion (Misc queries) | |||
Search multiple sheets, then paste results in new sheet | Excel Programming | |||
Search across multiple sheets and subtotal. | Excel Programming |