+ Reply to Thread
Results 1 to 7 of 7

Find A Record In Another Sheet With VBA Code

  1. #1
    Registered User
    Join Date
    07-19-2010
    Location
    Bucharest
    MS-Off Ver
    Office 2007
    Posts
    29

    Find A Record In Another Sheet With VBA Code

    Hi All;

    I'm trying to find a specific text in another sheet by using the code below. But it gives me "Type Mismatch" error. Being a beginner on Excel VBA coding, I couldn't figure it out. Any help will be appreciated.

    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,121

    Re: Find A Record In Another Sheet With VBA Code

    Try dumping the "With cst" and "End With". Not sure what you're trying to achieve with that but you don't need it. You've already stored the value in the variable so just loop through the range and test.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-19-2010
    Location
    Bucharest
    MS-Off Ver
    Office 2007
    Posts
    29

    Re: Find A Record In Another Sheet With VBA Code

    Quote Originally Posted by TMShucks View Post
    Try dumping the "With cst" and "End With". Not sure what you're trying to achieve with that but you don't need it. You've already stored the value in the variable so just loop through the range and test.

    Regards, TMS
    Thanks a lot for prompt reply.

    I've made the change you've proposed but I still get the same error.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,121

    Re: Find A Record In Another Sheet With VBA Code

    Not much I can suggest with what I have available to work with ... a sample workbook, maybe?

  5. #5
    Registered User
    Join Date
    07-19-2010
    Location
    Bucharest
    MS-Off Ver
    Office 2007
    Posts
    29

    Re: Find A Record In Another Sheet With VBA Code

    I've figured it out. I'm posting here so if anybody will need something similar can use. Mistake was

    Please Login or Register  to view this content.
    on first range definition line... and;

    Please Login or Register  to view this content.
    is should be "string" instead.

    full working version of the code is below;

    Please Login or Register  to view this content.
    The scenario I'm using this code is;
    There is a sheet named LIST in the workbook where all the customers are listed with their basic information. And all the customers on this list, have their own sheets for other individual data input. When user needs to update any basic information of a customer by returning to the main sheet, in order to find necessary line without an effort, user clicks on a button and code above kicks in.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,121

    Re: Find A Record In Another Sheet With VBA Code

    Perhaps:

    Please Login or Register  to view this content.

    Edit: change ActiveCell to be a cell with the ID you wish to search for.

    Regards, TMS
    Last edited by TMS; 07-12-2012 at 11:26 AM.

  7. #7
    Registered User
    Join Date
    07-19-2010
    Location
    Bucharest
    MS-Off Ver
    Office 2007
    Posts
    29

    Re: Find A Record In Another Sheet With VBA Code

    looks very elegant...
    sure I'll give it a try tonight.

    thanks a lot again TMS

    Regards.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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