+ Reply to Thread
Results 1 to 2 of 2

Modifing a recorded macro.

Hybrid View

  1. #1
    Duane Reynolds
    Guest

    Modifing a recorded macro.

    I would like to use this macro on 8-10 workbooks.

    Range("B3:P357").Select
    Selection.Copy
    ChDir "M:\"
    Workbooks.Open Filename:="M:\Expired Template.xlt", Editable:=True
    Range("E4").Select
    ActiveSheet.Paste
    Range("B4").Select
    Application.CutCopyMode = False
    ChDir "M:\North"
    Range("F4").Select
    ActiveCell.FormulaR1C1 = "ALLYN"
    ActiveWorkbook.SaveAs Filename:="M:\North\ALLYN.xls", FileFormat:=xlNormal _
    , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
    CreateBackup:=False
    End Sub

    I want to save the workbooks using the name in cell f4. the recorded macro
    has hard coded the name in first workbook uses it to name the other workbooks
    Thanks for the help in advance

    --
    Duane Reynolds
    XP Associate Expert

  2. #2
    Franz Verga
    Guest

    Re: Modifing a recorded macro.

    "Duane Reynolds" <DuaneReynolds@discussions.microsoft.com> ha scritto nel
    messaggio news:9523F888-F9A1-41D4-806A-355183C8B6C7@microsoft.com...
    >I would like to use this macro on 8-10 workbooks.
    >
    > Range("B3:P357").Select
    > Selection.Copy
    > ChDir "M:\"
    > Workbooks.Open Filename:="M:\Expired Template.xlt", Editable:=True
    > Range("E4").Select
    > ActiveSheet.Paste
    > Range("B4").Select
    > Application.CutCopyMode = False
    > ChDir "M:\North"
    > Range("F4").Select
    > ActiveCell.FormulaR1C1 = "ALLYN"
    > ActiveWorkbook.SaveAs Filename:="M:\North\ALLYN.xls", FileFormat:=xlNormal
    > _
    > , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
    > CreateBackup:=False
    > End Sub
    >
    > I want to save the workbooks using the name in cell f4. the recorded macro
    > has hard coded the name in first workbook uses it to name the other
    > workbooks
    > Thanks for the help in advance
    >


    Hi Duane,
    try with this:

    Sub Test()
    Dim filen As String

    Range("B3:P357").Copy
    Workbooks.Open Filename:="M:\Expired Template.xlt", Editable:=True
    Range("E4").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    filen = "M:\North\" & Range("F4").Value & ".xls"
    ActiveCell.FormulaR1C1 = "ALLYN"
    ActiveWorkbook.SaveAs filen, FileFormat:=xlNormal _
    , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
    CreateBackup:=False
    End Sub



    --
    Hope I helped you.

    Thanks in advance for your feedback.

    Ciao

    Franz Verga from Italy



+ 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