Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default 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
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 & Replace and Find & Insert macro help needed RS Excel Programming 2 January 29th 07 07:35 AM
Get Macro warning, but can't find Macro Stilla Excel Worksheet Functions 1 January 20th 07 01:27 AM
Macro - can't find cdris7319 Excel Discussion (Misc queries) 2 September 27th 06 06:43 PM
change error message when no more for "find" in macro to find swyltm Excel Programming 1 January 13th 06 05:16 PM
I need to find a macro to find data cut and paste to another colu. Rex Excel Programming 6 December 7th 04 09:22 AM


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