finding a value

  • Thread starter Thread starter tom
  • Start date Start date
T

tom

Hi,

How can I find a certain value, say x, in all the sheets
in a workbook or excel file? After finding it, I must
output all the sheet names that has x and its cell
location on a msgbox.

Thanks.
 
try this
sub findX()
dim i as integer
dim cell

set X=activecell.value
for i=1 to sheets.count
sheets(i).select
range("A1").select
set a=selection
range(a,a.specialcells(xlcelltypelastcell)).select
for each cell in selection
if cell.value=X.value then
msgbox "X.value is in sheet " & sheet.name
exit for
end if
next
next
end sub

regards
Mark
PS
see my Excel site
http://www.geocities.com/excelmarksway
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top