+ Reply to Thread
Results 1 to 9 of 9

Update existing VBA code - Remove blank rows

  1. #1
    Forum Contributor
    Join Date
    09-10-2012
    Location
    Slovakia
    MS-Off Ver
    Excel 365
    Posts
    174

    Update existing VBA code - Remove blank rows

    Hi friends,

    I got following example template with macro code which is doing following:

    Once you click on button "Create LOI" in sheet "Analysis" you will able to choose worker and then new sheet(s) will be created by using appropriate data from Analysis.

    As you can see, new sheets are created from default sheet called "LOI 4.0", where are input fields between rows 17 & 155.
    My problem is, that if I run macro and newly created sheets are updated by appropriate data I have a huge number of blank lines till row 155.
    Could you pls help me update following macro code which ensure that all rows without data in mentioned range will be deleted?

    Please Login or Register  to view this content.
    Thanks in advance for your help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Update existing VBA code - Remove blank rows

    Add this after Next r:

    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Forum Contributor
    Join Date
    09-10-2012
    Location
    Slovakia
    MS-Off Ver
    Excel 365
    Posts
    174

    Re: Update existing VBA code - Remove blank rows

    Quote Originally Posted by walruseggman View Post
    Add this after Next r:

    Please Login or Register  to view this content.
    Thank you, friend. It works perfectly. So simple . Thanks so much!

  4. #4
    Forum Contributor
    Join Date
    09-10-2012
    Location
    Slovakia
    MS-Off Ver
    Excel 365
    Posts
    174

    Re: Update existing VBA code - Remove blank rows

    Hi walruseggman, unfotunately I overlooked one bug yesterday. As I mentioned, if I updated macro as you advised it works, but not for all workers. I noticed these troubles if I run report for worker with name Dave. Refer to attached picture with results.
    blank rows.jpg

    Pls any idea what is wrong?

  5. #5
    Forum Contributor
    Join Date
    09-10-2012
    Location
    Slovakia
    MS-Off Ver
    Excel 365
    Posts
    174

    Re: Update existing VBA code - Remove blank rows

    It looks, that it doesn't work if under one worker is more than 1 account group.

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Update existing VBA code - Remove blank rows

    I don't know, that's nothing to do with the code I provided, it would relate to the original code.

  7. #7
    Forum Contributor
    Join Date
    09-10-2012
    Location
    Slovakia
    MS-Off Ver
    Excel 365
    Posts
    174

    Re: Update existing VBA code - Remove blank rows

    And some code at the end of this macro, which done following: "remove all blank rows in range C17:C155 in all newly created sheets by this code" couldn't help?

    Or any other solution?
    Last edited by Tapyr; 02-10-2016 at 09:45 AM.

  8. #8
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Update existing VBA code - Remove blank rows

    What I mean is that it was never explained what you expected the original code to do. When you say it's not working correctly because of x or y or z, it sounds like there is a problem with the original code, but we don't know what the code should be doing.

    To clarify: you say it "doesn't work" if there is more than one account per user, and that the CN- accounts for Dave are wrong but the KU- accounts are OK. But there's no explanation as to why this is or how to differentiate wrong from OK.

    Nevertheless, this is a different issue than the original purpose of this thread, so a new thread should be started with an appropriate title. You'll want to explain in detail all the end results you expect and how to achieve them, because even if someone takes the time to walk through your code, they're not going to know what's right or wrong.

  9. #9
    Forum Contributor
    Join Date
    09-10-2012
    Location
    Slovakia
    MS-Off Ver
    Excel 365
    Posts
    174

    Re: Update existing VBA code - Remove blank rows

    Sorry for confusion. Let me clarify my request.

    Original code provided by me works correctly. It creates new sheets per account groups for chosen worker(s). It works with account groups available column "A" (there is white text color, so it is not visible). As you already know, new sheets are creating from default template LOI 4.0. Basically this sheet is copied and updated accordingly by appropriate data from Analysis. For now everything works correctly.

    But I would like to update this code. I need to remove all blank lines in sheets created by this macro.

    Code provided by you works perfectly only if there is one group for each worker. However if there are more groups for 1 worker (for example worker Dave from my example file) your code works only partially. Under Dave are listed two groups KU- accounts & CN- accounts. In one created sheet are lines removed, but for second sheet nothing changed and there remained blank rows.

    Btw if you open example file there are more codes in Virtual basic. There is also Form. In simple explanation, all of these codes are assigned to button CREATE LOI. Unfortunately I am not so familiar with those codes and form and I supposed that updated should be only macro (Create_LOI_Sheets) provided by me at the beginning of this thread.

+ 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. update existing code to copy and KEEP existing data
    By scott micklo in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 01-26-2016, 05:41 PM
  2. [help with code] need to update existing code to copy and keep rows on input page
    By scott micklo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2016, 01:36 PM
  3. A code to remove any existing content in an automatic calendar
    By kimmier034 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 04-03-2015, 01:32 PM
  4. Macro to open closed file append new rows, and update existing rows
    By capson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-06-2014, 11:12 AM
  5. [SOLVED] VB Code help to change/update existing code
    By JDobbsy1987 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-24-2013, 04:46 PM
  6. VBA code to remove rows in case of blank cells
    By GrahamRoss in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2011, 12:02 PM
  7. VB code to update existing Pivot Table
    By suzetter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2005, 06:49 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