Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

deleting rows from excel

Posted on 2006-07-19
11
Medium Priority
?
197 Views
Last Modified: 2010-05-03
Hi,
I have a large excel sheet, with some blank rows in different locations, i want to delete all of these, is this possible?

thanks
0
Comment
Question by:markmchugh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 4

Expert Comment

by:BradB3030
ID: 17141674
Yes, you can use the Excel.Application object, you can loop through each row, check to see if there's information in specific cells...if not, you can delete it.

Example at home if you need it...
0
 

Author Comment

by:markmchugh
ID: 17141685
please, can you post an example?
0
 

Author Comment

by:markmchugh
ID: 17143264
got a solution.................. no need for anybody to post
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:markmchugh
ID: 17143294
sorry, the solution does not work.... i've increased the points available
0
 

Author Comment

by:markmchugh
ID: 17143479
ok, here is the solution i used, i used the following excel macro

Sub DeleteBlankRows1()
'Deletes the entire row within the selection if the ENTIRE row contains no data.

'We use Long in case they have over 32,767 rows selected.
Dim i As Long

      'We turn off calculation and screenupdating to speed up the macro.
      With Application
            .Calculation = xlCalculationManual
            .ScreenUpdating = False
     
      'We work backwards because we are deleting rows.
      For i = Selection.Rows.Count To 1 Step -1
            If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
                  Selection.Rows(i).EntireRow.Delete
            End If
      Next i

            .Calculation = xlCalculationAutomatic
            .ScreenUpdating = True
       End With
End Sub


to tun it

Open Excel.
Push Alt+F11 to open the VBE (Visual Basic Editor).
Go to Insert>Module.
Copy the code and paste it in the new module.
Push Alt+Q to return to Excels normal view.
Push Alt+F8 and then select the macro name and click Run. Or select Options and assign a shortcut key.


i got this from http://www.ozgrid.com/VBA/VBACode.htm

no need to comment further

thanks
0
 
LVL 1

Expert Comment

by:Youkko
ID: 17184301
So, if the solution is already found, what about closing this topic?
0
 

Author Comment

by:markmchugh
ID: 17195892
how do i close?
0
 
LVL 1

Expert Comment

by:Youkko
ID: 17195919
I believe if you accept your own answer would do...
0
 
LVL 1

Expert Comment

by:Youkko
ID: 17195923
If not, ask a moderator..
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 17371152
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

730 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