Solved

deleting rows from excel

Posted on 2006-07-19
11
188 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
11 Comments
 
LVL 4

Expert Comment

by:BradB3030
Comment Utility
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
Comment Utility
please, can you post an example?
0
 

Author Comment

by:markmchugh
Comment Utility
got a solution.................. no need for anybody to post
0
 

Author Comment

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

Author Comment

by:markmchugh
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 1

Expert Comment

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

Author Comment

by:markmchugh
Comment Utility
how do i close?
0
 
LVL 1

Expert Comment

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

Expert Comment

by:Youkko
Comment Utility
If not, ask a moderator..
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
Comment Utility
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

744 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

12 Experts available now in Live!

Get 1:1 Help Now