Results 1 to 2 of 2

Macro Error when File Name is Changed

Threaded View

  1. #1
    Registered User
    Join Date
    07-17-2009
    Location
    Key West, Florida
    MS-Off Ver
    Excel 2003
    Posts
    6

    Macro Error when File Name is Changed

    Hi,

    I have a macro that runs from a workbook called V1.4.xls. All the macro is doing is opening up a file in the C:, copying some data from the "CR" tab in V1.4.xls and pasting to the workbook opened from the C:

    My issue is I often need to change the filename of V1.4.xls, however when I do so, the macro debugs and I need to rename the filename within the macro. Does anyone know what I need to replace so the macro knows to reference back to the worksheet in which it was opened from, instead of having the specific filename in the macro? Below is the macro, I know the fix is changing line 5, would appreciate any help. Thanks!

        Workbooks.Open Filename:="C:\WebADI.xls"
        Range("I12:J13").Select
        Selection.NumberFormat = "General"
        Range("I12:J12").Select
        ActiveCell.FormulaR1C1 = "='[V1.4.xls]CR'!R155C9"
        Range("I12:J12").Select
        Selection.Copy
        Range("I13:J13").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
    Last edited by Leith Ross; 09-16-2009 at 01:05 PM. Reason: Addded Code Tags

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