+ Reply to Thread
Results 1 to 3 of 3

Editing recorded macro code. Referencing workbook name in functio

  1. #1
    Mark
    Guest

    Editing recorded macro code. Referencing workbook name in functio

    I created the following code using the macro recorder. What I need to do is
    find a way to replace the workbook name reference in the function with some
    generic reference that will always look in the open workbook -- no matter
    what the user names it.

    I think I know how to do it, in terms of creating variables to reference the
    workbook -- but I don't know how the syntax works in a worksheet function
    like this.

    Range("A64").Select
    ActiveCell.FormulaR1C1 = _
    "='[Functional Generic Estimating Model Loaded 1.1.xls]Summary
    Data'!R[440]C20"

  2. #2
    David
    Guest

    RE: Editing recorded macro code. Referencing workbook name in functio

    Hi Mark,

    Not sure this will do exactly what you want, but you maybe able to play with
    it and get what you want:
    Sub Macro1()
    Range("A64").Select
    Z = ActiveWorkbook.Name
    ActiveCell.FormulaR1C1 = _
    "='[" & Z & "]SummaryData '!R[440]C20"
    End Sub


    "Mark" wrote:

    > I created the following code using the macro recorder. What I need to do is
    > find a way to replace the workbook name reference in the function with some
    > generic reference that will always look in the open workbook -- no matter
    > what the user names it.
    >
    > I think I know how to do it, in terms of creating variables to reference the
    > workbook -- but I don't know how the syntax works in a worksheet function
    > like this.
    >
    > Range("A64").Select
    > ActiveCell.FormulaR1C1 = _
    > "='[Functional Generic Estimating Model Loaded 1.1.xls]Summary
    > Data'!R[440]C20"


  3. #3
    Mark
    Guest

    RE: Editing recorded macro code. Referencing workbook name in fun

    In all honesty, that is what I think I need. I just needed to know the
    syntax for referencing the variable in the worksheet function in the macro.
    Thanks.

    "David" wrote:

    > Hi Mark,
    >
    > Not sure this will do exactly what you want, but you maybe able to play with
    > it and get what you want:
    > Sub Macro1()
    > Range("A64").Select
    > Z = ActiveWorkbook.Name
    > ActiveCell.FormulaR1C1 = _
    > "='[" & Z & "]SummaryData '!R[440]C20"
    > End Sub
    >
    >
    > "Mark" wrote:
    >
    > > I created the following code using the macro recorder. What I need to do is
    > > find a way to replace the workbook name reference in the function with some
    > > generic reference that will always look in the open workbook -- no matter
    > > what the user names it.
    > >
    > > I think I know how to do it, in terms of creating variables to reference the
    > > workbook -- but I don't know how the syntax works in a worksheet function
    > > like this.
    > >
    > > Range("A64").Select
    > > ActiveCell.FormulaR1C1 = _
    > > "='[Functional Generic Estimating Model Loaded 1.1.xls]Summary
    > > Data'!R[440]C20"


+ 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