Solved

Dynamically select and delete a range of rows in Excel

Posted on 2014-03-07
3
388 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now