AboutTom Ogilvy Expertise Worked with the program for many years - provided assistance on MS Excel Newsgroups since 1997. Have received the Microsoft MVP award annually since 1999.
I don't answer questions on using Excel in a browser
Since I have no way to test this. Prefer not to answer charting questions. I consider myself to be particularly knowledgeable about using VBA internal to Excel but have no problems with formulas and pivot tables either.
Experience Have Used Excel for 15 - 20 years. Answered in excess of 70,000 Excel related questions in MS Excel newsgroups. Unless obvious, please specify whether you want a worksheet function or macro/VBA solution.
Education/Credentials BS General Engineering (concentration in Industrial Engineering)
MS Operations Research Systems Analysis
Question // (I post this question before but was send it to Bill, so Bill if you receive this again I apologize but I guess the link at the site might not be working correctly)//
Hi Tom,
I have this workbook with 5 different worksheets, in every of them there is a serial number at comuln A (e.g. A1 1001123, A2 1001321,...,Ax xxxxxx) what Im trying to do now is a macro that will look for en specific serial number. the thing is that I don't know in which worksheet will be, so the mac will look through all A column in sheet1, if nothing found will continue with columA of worhseet2 and so on until find it, what I'm looking for to be return is the adjacent cells in the same row where the serial number is. So if you can giveme some help, tip or advise, I'll really apreciate that.
regard
Answer Cesar,
Assume you have 6 sheets. The first sheet (sheet1) has a place to enter a serial number in A4 and then you run the macro to retrieve all the information from that serial number. The other 5 sheets are the ones you spoke of that contain serial number data with the serial numbers listed in column A of each sheet.
Sub GetData()
Dim sh As Worksheet, sh1 As Worksheet
Dim rng As Range, sn As Variant
' change the sheet name to the sheet where you entered the
' serial number in cell A4 to search for.
Set sh1 = Worksheets("Sheet1")
sn = sh1.Range("A4")
For Each sh In Worksheets
If sh.Name <> sh1.Name Then
Set rng = sh.Columns(1).Find(What:=sn, _
After:=sh.Range("A1"), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
rng.EntireRow.Copy sh1.Range("A4")
Exit For
End If
End If
Next
End Sub
I set up a test workbook consistent with the stated assumptions, entered a serial number in A4 of Sheet1 and ran the macro. It brought back all the data associated with that serial number and pasted it into row 4.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here