+ Reply to Thread
Results 1 to 9 of 9

Find and Replace across multiple worksheets?

  1. #1
    Registered User
    Join Date
    08-31-2013
    Location
    Irving, TX
    MS-Off Ver
    Excel 2010
    Posts
    2

    Post Find and Replace across multiple worksheets?

    I have a workbook with two sheets, "Patients" and "Prescriptions." Prescriptions is the primary worksheet that contains all the info I need.

    due to a normalization issue, I created a new record in my primary sheet, and it created a duplicate record of each patient I selected. So I've got multiple records for the same patient in my "Patients" sheet.

    I want to find replace everything in the "patient_id" column in "Prescriptions", to match up with the actual Patient name, not an ID number... rather than performing a find and replace one-by-one... Anybody know how to accomplish this?

    I've attached a sample of my sheet so you know what I'm talking about. The actual sheet contains over 5000 entries so a way to automate this process as much as possible is ideal.
    Attached Files Attached Files

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Find and Replace across multiple worksheets?

    Hello & Welcome to the Forum,

    How about on the 'Prescriptions' tab in cell E2 and copied down...

    =VLOOKUP(B2,Patients!$A$1:$B$7,2,0)
    HTH
    Regards, Jeff

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,653

    Re: Find and Replace across multiple worksheets?

    Try the attached.
    Attached Files Attached Files
    Last edited by jindon; 08-31-2013 at 08:00 PM. Reason: Attachment replaced

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Find and Replace across multiple worksheets?

    Hi Jindon,

    If have never seen this use of 'Static flg As Boolean', but then again VBA is not my strong suite.

    How exactly does this work? Is it basically within one session that it store a true the first run and then flips to false the next time run?

    How does it get stored as a variable a held? I thought usually once a macro was done the variable was dumped?

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,653

    Re: Find and Replace across multiple worksheets?

    It holds the value within a procedure until you close the file, when the variable declared by Static statement.

    e.g
    Please Login or Register  to view this content.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Find and Replace across multiple worksheets?

    Ok I see now. Thanks for the clarification.

  7. #7
    Registered User
    Join Date
    08-31-2013
    Location
    Irving, TX
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Find and Replace across multiple worksheets?

    Hey, thank you! the VLOOKUP function worked perfectly. I used "False" instead of the 0 and it worked the way I wanted. Thanks again guys!

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Find and Replace across multiple worksheets?

    You're welcome…glad you have a workable solution and thanks for the feedback...

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  9. #9
    Registered User
    Join Date
    09-01-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Find and Replace across multiple worksheets?

    Just "group" the various tabs you want and then do the Edit/Find. keep hitting Find and note how Excel scrolls thru each tab.

    To "group" tabs, hold down shift while clicking on each tab name...

    Thanks,

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Find and replace value in all worksheets in another workbook
    By thomass in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2013, 08:34 PM
  2. find and replace multiple values across multiple worksheets
    By Blake 7 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2012, 10:48 AM
  3. Multiple Find and Replace to replace a list of strings
    By WalterP34 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-11-2011, 07:41 PM
  4. Find and Replace from 5 worksheets
    By DustersCreations in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-28-2008, 10:05 PM
  5. [SOLVED] Find and Replace on all worksheets on all files in a folder
    By Rob Slagle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-27-2005, 11:06 AM

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