Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro / VBA for Find
Is it possible to write a macro or code so that value placed in a cell could
be found over all tabs? For example, if I place a value in cell D5, could I have the code behind a button that would searche for whatever value is in D5 over all tabs? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro / VBA for Find
Try this
Sub cellvalues() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets ws.Select MsgBox ("Cell D5 in " & ws.Name & " value is " _ & ActiveSheet.Cells(5, 4).Value) Next ws End Sub Is that any good? Mike "Gary" wrote: Is it possible to write a macro or code so that value placed in a cell could be found over all tabs? For example, if I place a value in cell D5, could I have the code behind a button that would searche for whatever value is in D5 over all tabs? Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro / VBA for Find
Hello Gary
'1-code behind your button: Private Sub CommandButton1_Click() ValuesFoundInD5 End Sub '2-code in a new module: Sub ValuesFoundInD5() Dim sh As Worksheet Dim TheValueinD5$ For Each sh In Sheets If sh.[D5] < "" Then TheValueinD5 = TheValueinD5 & vbLf & "Value " & sh.[D5] & " found in " & sh.Name End If Next sh Select Case TheValueinD5 Case Is < "" MsgBox "This is the result:" & vbLf & TheValueinD5, vbInformation Case Else MsgBox "No value was found in cell D5 in this workbook", vbInformation End Select End Sub HTH Regards Pascal "Gary" a écrit dans le message de news: ... Is it possible to write a macro or code so that value placed in a cell could be found over all tabs? For example, if I place a value in cell D5, could I have the code behind a button that would searche for whatever value is in D5 over all tabs? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find & Replace and Find & Insert macro help needed | Excel Programming | |||
Get Macro warning, but can't find Macro | Excel Worksheet Functions | |||
Macro - can't find | Excel Discussion (Misc queries) | |||
change error message when no more for "find" in macro to find | Excel Programming | |||
I need to find a macro to find data cut and paste to another colu. | Excel Programming |