Solved

Dynamically select and delete a range of rows in Excel

Posted on 2014-03-07
3
392 Views
Last Modified: 2014-03-07
For “Table 1” in the attached file in need a code that would dynamically select last row and delete all the blank rows below it except the blank row right above “Table 2”.  

Please see the attached file to get a better idea of what I’m trying to accomplish.  Please see the ‘Before’ and ‘After’ tab.  

The reason why I need something dynamic to accomplish this is that the number of rows in “Table 1” subject to change.
Example-Sheet.xlsx
0
Comment
Question by:KP_SoCal
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
ID: 39913122
Try this:

Range([B4].End(xlDown).Offset(3), Cells(Rows.Count, 2).End(xlUp).End(xlUp).Offset(-1)).EntireRow.Delete

Open in new window

0
 

Author Closing Comment

by:KP_SoCal
ID: 39913929
Very clean!  Thank you!!!
0
 
LVL 39

Expert Comment

by:nutsch
ID: 39914048
Glad to help.

Thomas
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question