Results 1 to 3 of 3

Please edit my macro to include all rows having data

Threaded View

  1. #1
    Registered User
    Join Date
    01-06-2013
    Location
    uae
    MS-Off Ver
    Excel 2010
    Posts
    12

    Please edit my macro to include all rows having data

    HI,

    I have recorded the following MACRO. I want to make 2 changes to it.
    For all the rows similar to the 3rd Row (RANGE (''B5:G6")), I want the selection to start at B5 but end till whichever row has DATA in it. (The no. of rows with data keep on changing).

    When this range will change then, the Range in the sheet in which this range is pasted "WARNINGS", should also dynamically change. So it CANNOT be RANGE "A1" Select, RANGE "A3" Select....so on

    Because if there are 10 Rows OR 15 Rows ( this no. of rows will keep on changing) with data in my MASTERSHEET, then the paste should automatically take place in RANGE "A11", or "A15" Depending on the initial no. or rows pasted.




    Sub Macro2()
    '
    ' Macro2 Macro
    '   
        Windows("MASTER SHEET 1.xlsm").Activate
        Sheets("1stWarn.").Select
        Range("B5:G6").Select
        Selection.Copy
        Windows("WARNINGS.xlsx").Activate
        Range("A1").Select
        ActiveSheet.Paste
        Windows("MASTER SHEET 2.xlsm").Activate
        Sheets("1stWarn.").Select
        Sheets("1stWarn.").Name = "1stWarn."
        Range("B5:G5").Select
        Application.CutCopyMode = False
        Selection.Copy
        Windows("WARNINGS.xlsx").Activate
        Range("A3").Select
        ActiveSheet.Paste
        Windows("MASTER SHEET 3.xlsm").Activate
        Sheets("1stWarn.").Select
        Sheets("1stWarn.").Name = "1stWarn."
        Range("B5:G5").Select
        Application.CutCopyMode = False
        Selection.Copy
        Windows("WARNINGS.xlsx").Activate
        Range("A4").Select
        ActiveSheet.Paste
        Windows("MASTER SHEET 3.xlsm").Activate
        Windows("MASTER SHEET 4.xlsm").Activate
        Sheets("1stWarn.").Select
        Sheets("1stWarn.").Name = "1stWarn."
        Range("B5:G6").Select
        Application.CutCopyMode = False
        Selection.Copy
        Windows("WARNINGS.xlsx").Activate
        Range("A5").Select
        ActiveSheet.Paste
        Windows("MASTER SHEET 5.xlsm").Activate
        Sheets("1stWarn.").Select
        Sheets("1stWarn.").Name = "1stWarn."
        Range("B5:G5").Select
        Application.CutCopyMode = False
        Selection.Copy
        Windows("WARNINGS.xlsx").Activate
        Range("A7").Select
        ActiveSheet.Paste
        Windows("MASTER SHEET 6.xlsm").Activate
        Sheets("1stWarn.").Select
        Range("B5:G6").Select
        Application.CutCopyMode = False
        Selection.Copy
        Windows("WARNINGS.xlsx").Activate
        Range("A8").Select
        ActiveSheet.Paste
    End Sub
    Last edited by 6StringJazzer; 12-08-2014 at 03:36 PM. Reason: cleaned up tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 11-03-2014, 12:06 PM
  2. [SOLVED] Editing a Macro to include multiple rows and include text formatting for leading zeros
    By missmea2005 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-04-2014, 09:50 AM
  3. [SOLVED] Edit existing macro to include week change
    By adamsurpren in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2012, 08:11 AM
  4. [solved] edit macro to include all sheets, all data
    By simpson in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-04-2010, 12:18 AM
  5. Macro to include addtional rows/columns
    By namz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-10-2008, 11:47 PM

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