+ Reply to Thread
Results 1 to 6 of 6

VBA Macro copy paste inserts blank row

  1. #1
    Registered User
    Join Date
    11-12-2017
    Location
    Stafford, England
    MS-Off Ver
    365
    Posts
    167

    VBA Macro copy paste inserts blank row

    Hi,

    In the attached workbook, on the sheet named "Closed Adjustments" when the "RUN" button is clicked it copies the data from this sheet in to corresponding sheets matching the code in column I.

    Everything works fine but as you can see if you click "RUN", this inserts a blank Row 5 between the headings and the copied data only on the numbered sheets and not the main sheet. I've tried changing the code but now need help.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,445

    Re: VBA Macro copy paste inserts blank row

    The does not insert blank rows, rather it copies into Range("A5")— row 5

    Change it to A2 or A1

    .SpecialCells(12).Copy Sheets(ws).Range("A1")

  3. #3
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA Macro copy paste inserts blank row

    Can't be sure without actually running the code step by step, but it could be your autofilter. You are filtering on column I and then using visible cells to copy the data. There are two empty rows at the top of column I and the autofilter could be counting one or both as a visible row.
    Last edited by JLGWhiz; 11-30-2018 at 04:16 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    11,138

    Re: VBA Macro copy paste inserts blank row

    I noticed that you made use of the code supplied in thread below...
    The norm would be a sign of appreciation or acknowledgement if one's code is used...which in this post was not the case...
    https://www.excelforum.com/excel-pro...new-sheet.html

    This adapted code should solve...
    Please Login or Register  to view this content.
    Last edited by sintek; 11-30-2018 at 04:23 PM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Registered User
    Join Date
    11-12-2017
    Location
    Stafford, England
    MS-Off Ver
    365
    Posts
    167

    Re: VBA Macro copy paste inserts blank row

    Thanks sintek,

    Apologises for the lack of respect shown, I decided to change my choice of code after I'd marked as solved on my last thread due to style of workbook changing.

    This works great and as long as I don't change my layout again I see no problems arising.

    Thanks again.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    11,138

    Re: VBA Macro copy paste inserts blank row

    All good

+ 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. Some help with copy/paste to next blank line macro
    By bbennett77 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2017, 01:33 AM
  2. [SOLVED] Copy last 3 columns, paste into next blank column macro
    By rossp1977 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-16-2015, 11:06 AM
  3. Macro: Copy/Paste values From Column to Next Blank Row
    By Lisseth225 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-23-2014, 05:39 PM
  4. [SOLVED] Macro to copy and paste sepcial into next blank row
    By CharlieZangel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2013, 04:24 PM
  5. [SOLVED] copy/paste macro to selected blank cells
    By fumc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-04-2012, 10:08 PM
  6. Copy and paste macro-blank cells thereafter.
    By Bikernick in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-04-2006, 12:00 PM
  7. Macro copy and paste = blank worksheet
    By efface in forum Excel General
    Replies: 1
    Last Post: 04-27-2006, 04:52 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