+ Reply to Thread
Results 1 to 18 of 18

Combine Multiple Macros

Hybrid View

  1. #1
    Registered User
    Join Date
    04-11-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007/10
    Posts
    19

    Re: Combine Multiple Macros

    Oh Yea, it might help eh XD

    1st i want it to save using cell value.

    Public Sub SaveAsD1()
        ThisFile = Range("D1").Value
        ActiveWorkbook.SaveAs Filename:=ThisFile
    End Sub
    2nd i want it to replace all the formula on sheet2 with there actual values.

    Sub Replace_Value()
    With Range("Print_Area")
    .Cells.Copy
    .Cells.PasteSpecial xlPasteValues
    .Cells(1).Select
    End With
    Application.CutCopyMode = False
    End Sub
    Then i want it to save sheet 2 on its own. (i just replaced this one with the code you helped me with before the one i was using was saving all the sheets individually, i only needed sheet2)

    Sub Split2()
    Dim fn As String
    fn = Range("FINAL SOLIDS'!C1").Value & ".xls"
    Sheets("FINAL_SOLIDS").Copy
    
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Users\BOI\Desktop\AUTO EMAIL\FILES TO EMAIL" & fn
    End Sub
    Would this be possible to combine?
    Last edited by arlu1201; 04-11-2013 at 07:52 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Combine Multiple Macros

    Since we are saving the file twice with 2 different names, whenever we use the range or sheet comments, its better to name the workbook and the sheet along with it. For e.g. if we are referring to a worksheet, we name the workbook as well. If we are referring to a range, we name the workbook and the sheet to which it pertains. This ensures that the macro works correctly and only on the workbooks we need.

    So please provide the workbook names for each code.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    04-11-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007/10
    Posts
    19

    Re: Combine Multiple Macros

    Sorry i will do that in my future posts.

    Workbook? If you mean the actual file its self it has a name (M+M FINAL PACKING LIST SOLIDS)
    also the worksheets have been renamed to MASTER SOLIDS and FINAL SOLIDS.

    If you dont mean like that how would i rename it?

+ Reply to Thread

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