Results 1 to 11 of 11

Merge two macros together to make them work with each other

Threaded View

BusinessHack Merge two macros together to... 04-03-2016, 02:41 AM
gmr4evr1 Re: Merge two macros together... 04-03-2016, 09:17 AM
BusinessHack Re: Merge two macros together... 04-03-2016, 08:47 PM
alansidman Re: Merge two macros together... 04-03-2016, 09:25 AM
gmr4evr1 Re: Merge two macros together... 04-04-2016, 12:11 PM
BusinessHack Re: Merge two macros together... 04-05-2016, 03:27 AM
gmr4evr1 Re: Merge two macros together... 04-06-2016, 03:48 PM
BusinessHack Re: Merge two macros together... 04-06-2016, 06:09 PM
gmr4evr1 Re: Merge two macros together... 04-07-2016, 04:56 PM
BusinessHack Re: Merge two macros together... 04-18-2016, 10:59 PM
gmr4evr1 Re: Merge two macros together... 04-19-2016, 11:00 AM
  1. #1
    Registered User
    Join Date
    07-21-2015
    Location
    Melbourne, Australia
    MS-Off Ver
    MAC 2011
    Posts
    7

    Merge two macros together to make them work with each other

    Hi,

    I need to merge to Macros to work with each other.

    The first Macro grabs names in a cell range then makes new tab names with the names in those cells -

    Sub Invoices_Add_Named_Tabs()
        Dim MyCell As Range, MyRange As Range
         
        Set MyRange = Sheets("Address").Range("A2")
        Set MyRange = Range(MyRange, MyRange.End(xlDown))
    
        For Each MyCell In MyRange
            Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
            Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet
        Next MyCell
    End Sub
    The other macro copies a sheet and all its data into a new sheet -

    Sub Invoices_Add_Invoice()
        Dim x As Integer
        
        x = InputBox("Enter number of times to copy Sheet1")
        For numtimes = 1 To x
            'Loop by using x as the index number to make x number copies.
            'Replace "Sheet1" with the name of the sheet to be copied.
            ActiveWorkbook.Sheets("Invoice").Copy _
               After:=ActiveWorkbook.Sheets("Address")
        Next
    End Sub
    I need the macro to make a new sheet according to the names in the cell range, and copy into each of the new tab the data from sheet "Invoice", so one month i may have 8 names, then the next month may have 16 names.

    so for example if there is 8 cells to be made into 8 named tabs, then each of the 8 newly made tabs will have the same data from the sheet "Invoice"

    if there are 16 cells to be made into 16 named tabs, then each of the 16 newly made tabs will have the same data from the sheet "Invoice"

    Thank You in advance
    Last edited by alansidman; 04-03-2016 at 09:25 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Single macros to work on 2 files to merge, is it possible
    By dainova in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-14-2014, 10:10 PM
  2. [SOLVED] How to make 2 macros work
    By aaron061883 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-05-2013, 10:15 PM
  3. Replies: 2
    Last Post: 07-31-2012, 04:22 PM
  4. how can i make macros to work when in tools, costumize and option.
    By MOLECULA0_0 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-17-2006, 11:54 PM
  5. Replies: 1
    Last Post: 05-02-2006, 12:45 PM
  6. make macros (sub) work for add-in?
    By meow@regretless.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2005, 11:25 PM
  7. Replies: 2
    Last Post: 11-11-2005, 02:25 AM
  8. How can I make Excel Macros created on PC work on Macintosh?
    By best_before in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-28-2005, 12:06 PM

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