+ Reply to Thread
Results 1 to 5 of 5

Update VBA code - remove blank rows in newly created sheets

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

    Update VBA code - remove blank rows in newly created sheets

    Hi friends,

    I would like to kindly ask you for help with updating of VBA code in attached example spreadsheet.

    Let me simple clarify what this file is doing and what I need to update.

    1. In sheet Analysis are data with workers (column "B") & account groups(column "C")
    2. Once you click on button CREATE LOI you will be able to choose one or more workers for which you want to create new sheet(s)
    3. New sheets are created from default tab LOI 4.0 and fill in by appropriate data from Analysis for each worker/account group's combination
    4. In final you can see new sheet(s) called per account group (e.q. CN-XX-XXXX-250X0X-PX0XX)
    5. In new sheets was data pasted in range between rows 17-155.
    6. At the end you will see the huge number of blank rows in created sheets.


    My request:
    Could you pls help me to update VBA code in attached example file, which ensure, that blank lines up to row 155 in every newly created sheet will be automatically deleted?

    I suppose below code used in attached file should be updated, but I'm not sure:
    Please Login or Register  to view this content.
    Thank you very much for your help
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Update VBA code - remove blank rows in newly created sheets

    I added my effort beneath what you have, rather than copying your entire original code. You can relocate the dims if you like cleaner code. It works for me, though getting it to work on 'Dave' - who has two account groups and thus creates two new sheets - required a loop through the sheets. The danger there is if you run the 'Create LOI' function for a worker, then immediately run it again for another worker , the loop created by the second trip through will do some unwanted deleting on the first created sheet. My contribution below therefore works as requested, but you'll need to relocate each new sheet to another workbook before running it again.

    If it's an option, I strongly recommend hiding the unused rows between 17 & 155 rather than deleting them. Hiding the rows would avoid the complication described above, allowing you to use 'Create LOI' consecutively.

    Please Login or Register  to view this content.

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

    Re: Update VBA code - remove blank rows in newly created sheets

    Hi cantosh, thanks a lot for your answer. I agree with you, that use "hide" option is much better for my purpose. Your update fully reach my expectation. Big thanks, man!!!!!

  4. #4
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Update VBA code - remove blank rows in newly created sheets

    My Pleasure! Don't forget to mark the thread as 'Solved' if you're all set.

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

    Re: Update VBA code - remove blank rows in newly created sheets

    Sure, already did it.

+ 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] Update existing VBA code - Remove blank rows
    By Tapyr in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-10-2016, 10:41 AM
  2. Code to place code into newly created sheets???
    By brucemc777 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-29-2014, 11:52 AM
  3. VBA: format newly created sheets as text
    By maria.blue44 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-04-2013, 09:13 PM
  4. [SOLVED] Code not working on newly created workbooks.
    By dwhite30518 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 05-21-2012, 02:04 PM
  5. Update master list with newly created files
    By alaskangrown in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-13-2011, 09:30 AM
  6. Using a macro to add code to a newly created workbook.
    By Alagard in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-16-2010, 06:08 PM
  7. Newly Created Sheets Replacing Existing
    By degmania in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-20-2008, 04:04 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