Results 1 to 4 of 4

Find & Replace Macro

Threaded View

  1. #1
    Registered User
    Join Date
    09-25-2008
    Location
    PA
    Posts
    2

    Find & Replace Macro

    I have a macro that replaces contents in about 120 cells on a sheet and 12 sheets in a workbook. When I run the macro I get a message box File not Found. The File is there and and when I select it and hit OK, it will replace the contents in the first cell. But I have to hit OK to replace each cell. I want it to run through all sheets. It worked on my old computer, but doesn't on my new computer. I tried it on 2 other computers with the same results. Here is cell contents: C:\Bakery 2008\[DAILY-08.xls]JANUARY DAILY'!$CI$1 I want to change to C:\Bakery 2009\[DAILY-09.xls]JANUARY DAILY'!$CI$1
    Daily-09.xls is another workbook and the file it is saying it can't find. Below is the Macro: Thanks

    Sub InvoiceChangeYear()
    '
    ' InvoiceChangeYear Macro
    ' Macro recorded 12/4/2007 by Keith A Roberts
    '
    
    '
        ActiveSheet.Unprotect
        Cells.Replace What:="Bakery 2008\[DAILY-08", Replacement:= _
            "Bakery 2009\[DAILY-09", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase _
            :=False
        ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    End Sub
    Sub InvoiceChangeYearAll()
    '
    ' InvoiceChangeYearAll Macro
    ' Macro recorded 12/4/2007 by Keith A Roberts
    '
    
    '
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("February Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("March Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("April Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("May Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("June Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("July Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("August Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("September Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("October Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("November Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        Sheets("December Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
        ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
        Sheets("January Invoice").Select
        Application.Run "'AMERICAN-LEGION-INV-08.xls'!InvoiceChangeYear"
    End Sub
    Last edited by VBA Noob; 09-26-2008 at 01:52 AM. Reason: Not using code tags as per forum rules

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Find Multiplex Text Values And Replace
    By RICKSTER1905 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-07-2008, 02:25 AM
  2. Find and Replace
    By cooh23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2008, 03:19 AM
  3. Find and replace
    By si666 in forum Excel General
    Replies: 3
    Last Post: 09-28-2007, 05:39 PM
  4. Search and replace macro
    By timecop in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-01-2007, 08:06 AM
  5. Creating a macro to find and/or replace text
    By julvaz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-30-2007, 11:57 AM

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