Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

excel woe

Name: Anonymous 2008-10-13 7:53

Hey /prog/
I'm trying to write some VBA code for use in Excel 2007. I have a list of serial numbers and I need to know if they appear _anywhere_ in a multisheet workbook. If possible it should also output the name of the sheet and a link to the cell. Serials to find start in A1 on a new sheet at position 1 and never number more than 100.

Below is my laughable attempt, the idea I had was that after a search if something was found then you'll be on that sheet instead of the one you started on. Currently always reports 'not found'

Sub Macro2()

    Dim FindMe As String
    Dim StartTab As String
    Dim EndTab As String
    Dim FoundTab As String
   
    StartTab = ActiveSheet.Name
    FindMe = Selection.FormulaR1C1
   
Range("A1").Select
                   
On Error Resume Next

    Cells.Find(What:=FindMe, After:=ActiveCell, LookIn:=xlValues, _
        LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate
     
    EndTab = ActiveSheet.Name
   
    If StartTab = EndTab Then
        FoundTab = "Not found"
    Else
        FoundTab = EndTab
    End If
   
    Sheets(StartTab).Select
    Selection.Offset(0, 1).Select
    Selection.FormulaR1C1 = FoundTab
    Selection.Offset(1, -1).Select     'these move on ready for the next find
        
End Sub

Name: Anonymous 2008-10-13 11:46

NO EXCEPTIONS

Name: VISUAL BASIC HATER 2008-10-13 12:10

Sage for any use of visual basic, for anything, ever.

Name: Anonymous 2008-10-14 4:56

bmup

Name: VISUAL BASIC HATER 2008-10-14 5:11

Sage for any use of visual basic, for anything, ever.

Name: Anonymous 2008-10-14 5:54

bmup

Name: HMA FAN 2008-10-14 7:21

hax my VB form

Name: Anonymous 2008-10-14 20:59

VB.NET isn't too bad, but VBA is the devil's language.

Name: Anonymous 2008-10-15 8:01

excel stuff

Name: Anonymous 2008-10-16 19:03

Stop rewriting Ctrl-F, you shithead.

Name: Excel 2008-10-17 4:56

HAIL, IL PALAZZO-SAMA.

Name: Anonymous 2008-10-17 8:02

CTRL+F IS JUST GREAT FUN TO USE ON LARGE LISTS
ESPECIALLY AS EXCEL 2007'S FIND FUNCTION IS COMPLETELY BROKEN
LARGE LETTERS MEAN I AM IMPORTANT

Name: Anonymous 2009-08-17 0:16

Lain.

Don't change these.
Name: Email:
Entire Thread Thread List