+ Reply to Thread
Results 1 to 2 of 2

Macro not functioning correctly, despite correct code

  1. #1
    Registered User
    Join Date
    09-24-2012
    Location
    Cambridge, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Question Macro not functioning correctly, despite correct code

    Hi all,

    I have a spreadsheet which is designed to store all of my departments projects. I have a macro on a button which will find any job associated with a specific number entered by the user. I have done the same but to search for words associated, and this works fine, however the number one only finds those which have a letter incorporated, and not all those containing the number e.g. it will find a job code 12151a but not 12151.

    The macro was made just using the 'record macro' function, and sets the auto filter to 'contains x' in the job number colum. My code is as below:

    Sub Findjobno()
    '
    ' Findjobno Macro
    '

    '
    Sheets("Projects").Select
    Cells.Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$1:$AJ$39").AutoFilter Field:=3, Criteria1:="=*" & Sheets("Search").Range("F16") & "*", Operator:=xlAnd


    End Sub

    Any thoughts??

    Many thanks!
    Helen


  2. #2
    Registered User
    Join Date
    09-24-2012
    Location
    Cambridge, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro not functioning correctly, despite correct code

    Does anyone have any thoughts on this? I think its because the find function mustnt count numbers alone, but I'm not sure how else to do it!

    Any help much appreciated

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    Helen

    You are using AutoFilter in the posted code not Find.
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1