+ Reply to Thread
Results 1 to 3 of 3

Add a row to multiple worksheets and copy some data drom the previous row

  1. #1
    Registered User
    Join Date
    01-06-2012
    Location
    Stratford, England
    MS-Off Ver
    Excel 2007
    Posts
    15

    Add a row to multiple worksheets and copy some data drom the previous row

    Hi all! I'm pretty new to VBA macors, I generally stumble my way around google to figure these things out which has got me so far but I've finally gotten stuck. So far, I have the following macro:

    Please Login or Register  to view this content.
    Based on a macro I found elsewhere and that I've tweaked to try and get it a little closer to what I need. The goal of the macro is that I can select a cell in Sheet1, click the macro button and then it will add a row above the selected row on both that sheet as well as sheets 3 & 4, copying the formatting from the previous row and also copying over the formula. The only small problem is that I don't want it to copy the formula from the whole row, only the first four columns, which is where my knowledge is lacking. I know I need to replace the EntireRow part of that line, but I can't figure out what to replace it with. And I'll be honest, I understand about 50% of the macro I posted above, it's just things I've found and seem to work, but if there's a cleaner/better way of doing then then I'll be glad to hear. Any suggestions would be appreciated!

    Edit: While typing this out I was making occasional tweaks to the macro, and apparently managed break it at some point, I'll edit again once I manage to figure out what I did and get it back working again.
    Last edited by iviv; 03-21-2017 at 07:46 AM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Add a row to multiple worksheets and copy some data drom the previous row

    Try amending this line
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-06-2012
    Location
    Stratford, England
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Add a row to multiple worksheets and copy some data drom the previous row

    Hi Stephen,

    Thanks for the fast reply. Unfortunately, your line doesn't appear to be working, though I believe this could be because I somehow mucked up another part of the macro. Originally just the line adding part was working, but for whatever reason it isn't now. The macro I posed above is correctly adding the line in the main Sheet1, but on sheets 2 and 4 it appears to be carrying out the two paste functions, but it isn't inserting a new row, meaning that it's overwriting the row with data from the previous row.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to copy a formula to multiple worksheets that references the previous worksheet
    By robnsd in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-27-2015, 07:37 AM
  2. Copy/Paste Range of Data from Multiple Workbooks/Worksheets to Master Workbook/Worksheets
    By NumberCruncher311 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-19-2013, 08:21 PM
  3. Copy data drom selected cells to new one worksheet (row)
    By michael12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2012, 07:24 AM
  4. copy a data from multiple worksheets (more than 1000)
    By angelini in forum Excel General
    Replies: 0
    Last Post: 06-13-2011, 05:40 PM
  5. copy data across worksheets and add multiple lines
    By madwoman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-13-2006, 08:35 AM
  6. [SOLVED] Copy data in multiple worksheets
    By kfletchb in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-10-2006, 07:25 PM
  7. Copy only certain data from multiple worksheets
    By Matt in forum Excel General
    Replies: 0
    Last Post: 02-10-2006, 11:10 AM

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