VBA Copy Paste deletes first row after filter blanks

  • I have managed to achieve more or less what i wanted, which is to copy paste a set of rows and delete blanks from examples i found here and on the web.

    But the problem now is after i have copied and paste the rows, i noticed that the first row is always deleted and after i paste another set of rows, the first row gets deleted again.

    Here is the code. Since i merely copied the codes, i dont fully understand what they do thus i am unable to find the mistake. Hope you guys can help me here.

  • Possibly...

    If I've been helpful, let me know. If I haven't, let me know that too. 

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post

    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.

    How to use code tags

    Note: no apostrophe in the tags, just used for demonstration here.


    your code goes between these tags


    Or, just highlight all of the code and press the <> in the post menu above button to add the code tags.


  • Try this. If it doesn't work attach an example workbook showing the layout of the data.

  • Noted, thanks for the heads up and sorry for the mistake. I have also attached the said excel file, code runs with no error but 1 row at the top still gets deleted after pasting. Thanks for taking time to look into this.

    oh, please pardon my method of sorting and getting the data i want, i am a total noob at this.

  • Which sheet are you filtering? It should be called Main but it isn't in the attached workbook.

    Also, your code is working on two workbooks, I presume the sheet should be in OutPut.

  • Try...

    If I've been helpful, let me know. If I haven't, let me know that too. 

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!